diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000..bab9054 --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":[],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/dryrun.log b/.vscode/dryrun.log new file mode 100644 index 0000000..6cc17d6 --- /dev/null +++ b/.vscode/dryrun.log @@ -0,0 +1,6 @@ +make.exe --dry-run --always-make --keep-going --print-directory +make: Entering directory 'c:/Users/DKing/Documents/GitHub/snowflake_fivetran_vhol' +make: Leaving directory 'c:/Users/DKing/Documents/GitHub/snowflake_fivetran_vhol' + +make: *** No targets specified and no makefile found. Stop. + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..72d4912 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} \ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000..0ea8569 --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,295 @@ +make.exe all --print-data-base --no-builtin-variables --no-builtin-rules --question +make: *** No rule to make target 'all'. Stop. + +# GNU Make 4.3 +# Built for Windows32 +# Copyright (C) 1988-2020 Free Software Foundation, Inc. +# License GPLv3+: GNU GPL version 3 or later +# This is free software: you are free to change and redistribute it. +# There is NO WARRANTY, to the extent permitted by law. + +# Make data base, printed on Thu Jul 14 14:22:38 2022 + +# Variables + +# environment +FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer +# environment +SYSTEMDRIVE = C: +# environment +JAVA_HOME = C:\Users\DKing\AppData\Local\Programs\AdoptOpenJDK\ +# environment +LC_ALL = C +# environment +USERPROFILE = C:\Users\DKing +# environment +VBOX_MSI_INSTALL_PATH = C:\Program Files\Oracle\VirtualBox\ +# environment +LOCALAPPDATA = C:\Users\DKing\AppData\Local +# environment +VSCODE_CWD = C:\Users\DKing\AppData\Local\Programs\Microsoft VS Code +# environment +CHOCOLATEYINSTALL = C:\ProgramData\chocolatey +# environment +SYSTEMROOT = C:\WINDOWS +# environment +PROCESSOR_LEVEL = 6 +# environment +PSMODULEPATH = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules +# default +MAKE_COMMAND := C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe +# environment +USERDNSDOMAIN = USXPRESS.COM +# automatic +@D = $(patsubst %/,%,$(patsubst %\,%,$(dir $@))) +# environment +CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_9960_JZBVRSXSOTOHSVIA +# environment +FPS_BROWSER_USER_PROFILE_STRING = Default +# environment +VSCODE_HANDLES_UNCAUGHT_ERRORS = true +# default +.VARIABLES := +# automatic +%D = $(patsubst %/,%,$(patsubst %\,%,$(dir $%))) +# environment +M2_REPO = C:\Users\DKing\.m2\repository +# automatic +^D = $(patsubst %/,%,$(patsubst %\,%,$(dir $^))) +# automatic +%F = $(notdir $%) +# environment +VSCODE_CODE_CACHE_PATH = C:\Users\DKing\AppData\Roaming\Code\CachedData\b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a +# environment +LANG = C +# default +.LOADED := +# environment +TMP = C:\Users\DKing\AppData\Local\Temp +# default +.INCLUDE_DIRS = . +# environment +PROCESSOR_ARCHITEW6432 = AMD64 +# makefile +MAKEFLAGS = pqrR +# environment +ONEDRIVE = C:\Users\DKing\OneDrive +# environment +INTELLIJ IDEA COMMUNITY EDITION = C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.3\bin; +# makefile +CURDIR := c:/Users/DKing/Documents/GitHub/snowflake_fivetran_vhol +# environment +SPARK_HOME = C:\Spark\spark-3.1.1-bin-hadoop2.7 +# environment +APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1 +# automatic +*D = $(patsubst %/,%,$(patsubst %\,%,$(dir $*))) +# environment +PROGRAMFILES = C:\Program Files (x86) +# environment +MFLAGS = -pqrR +# default +.SHELLFLAGS := -c +# environment +COMMONPROGRAMW6432 = C:\Program Files\Common Files +# automatic ++D = $(patsubst %/,%,$(patsubst %\,%,$(dir $+))) +# makefile +MAKEFILE_LIST := +# automatic +@F = $(notdir $@) +# environment +VSCODE_PID = 9960 +# environment +HVR_HOME = C:\hvr\hvr_home +# automatic +?D = $(patsubst %/,%,$(patsubst %\,%,$(dir $?))) +# automatic +*F = $(notdir $*) +# automatic +- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Python packages + run: | + python3 -m venv venv + . venv/bin/activate + pip install -U pip wheel + pip install dbt-core dbt-postgres dbt-bigquery dbt-snowflake + + - name: Create GCP service account + run: 'echo "$KEYFILE" > $DBT_GOOGLE_BIGQUERY_KEYFILE' + shell: bash + env: + KEYFILE: ${{ secrets.DBT_GOOGLE_BIGQUERY_KEYFILE }} + + - name: Install dbt dependencies + run: | + . venv/bin/activate + dbt deps --project-dir $DBT_PROJECT_DIR + + - name: Integration Tests (Postgres) + if: ${{ env.ACT == false }} + run: | + . venv/bin/activate + dbt build -t postgres --project-dir $DBT_PROJECT_DIR + + - name: Integration Tests (BigQuery) + if: ${{ env.ACT == false }} + run: | + . venv/bin/activate + dbt build -t bq --project-dir $DBT_PROJECT_DIR + + - name: Integration Tests (Snowflake) + run: | + . venv/bin/activate + dbt build -t snowflake --project-dir $DBT_PROJECT_DIR + diff --git a/dbt_packages/dbt_date/.gitignore b/dbt_packages/dbt_date/.gitignore new file mode 100644 index 0000000..83beff7 --- /dev/null +++ b/dbt_packages/dbt_date/.gitignore @@ -0,0 +1,5 @@ + +target/ +dbt_packages/ +logs/ +.python-version diff --git a/dbt_packages/dbt_date/CHANGELOG.md b/dbt_packages/dbt_date/CHANGELOG.md new file mode 100644 index 0000000..5d20e41 --- /dev/null +++ b/dbt_packages/dbt_date/CHANGELOG.md @@ -0,0 +1,82 @@ +# dbt-date v0.5.7 +* Add github actions workflow by @clausherther in https://github.com/calogica/dbt-date/pull/69 +* Fix Redshift timezone conversion macro by @wellykachtel in https://github.com/calogica/dbt-date/pull/71 + +# dbt-date v0.5.6 +* Fix missing bracket by @clausherther in https://github.com/calogica/dbt-date/pull/66 + +# dbt-date v0.5.5 +* Fix README table of contents' links by @coisnepe [#61](https://github.com/calogica/dbt-date/pull/61) +* Fix timezone conversion macro on redshift by @msnidal [#63](https://github.com/calogica/dbt-date/pull/63) + +# dbt-date v0.5.4 +* Updated Documentation [#60](https://github.com/calogica/dbt-date/pull/60) + +# dbt-date v0.5.3 +* Allow negative shift year for fiscal periods ([#57](https://github.com/calogica/dbt-date/issues/57) [@boludo00](https://github.com/boludo00)) + +# dbt-date v0.5.2 +* Fix [#55](https://github.com/calogica/dbt-date/issues/55) by removing dead macro. + +# dbt-date v0.5.1 +* Fix `week_start` and `week_end` on Snowflake ([#53](https://github.com/calogica/dbt-date/issues/53), [#54](https://github.com/calogica/dbt-date/pull/54)) + +# dbt-date v0.5.0 +* Deprecates support for dbt < 1.0.0 + +# dbt-date v0.4.2 +## Under the hood +* Patch: adds support for dbt 1.x + +# dbt-date v0.4.1 + +## Under the hood +* Support for dbt 0.21.x + +# dbt-date v0.4.0 + +## Breaking Changes + +* Updates calls to adapter.dispatch to support `dbt >= 0.20` (see [Changes to dispatch in dbt v0.20 #34](https://github.com/calogica/dbt-date/issues/34)) + +* Requires `dbt >= 0.20` + +## Under the hood + +* Adds tests for timestamp and timezone macros (previously untested, new dbt version highlighted that) + +# dbt-date v0.3.1 + +*Patch release* + +## Fixes + +* Fixed a bug in `snowflake__from_unixtimestamp` that prevented the core functionaility from being called ([#38](https://github.com/calogica/dbt-date/pull/38) by @swanderz) + +## Under the hood + +* Simplified `join` syntax ([#36](https://github.com/calogica/dbt-date/pull/36)) + +# dbt-date v0.3.0 + +## Breaking Changes + +* Switched `day_of_week` column in `get_date_dimension` from ISO to *not* ISO to align with the rest of the package. [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina) + +## Features + +* Added `day_of_week_iso` column to `get_date_dimension` [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina) + +* Added `prior_year_iso_week_of_year` column to `get_date_dimension` + +## Fixes + +* Refactored Snowflake's `day_name` to not be ISO dependent [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina) + +* Fixed data types for `day_of_*` attributes in Redshift ([#28](https://github.com/calogica/dbt-date/pull/28) by @sparcs) + +* Fixed / added support for date parts other than `day` in `get_base_dates` ([#30](https://github.com/calogica/dbt-date/pull/30)) + +## Under the hood + +* Making it easier to shim macros for other platforms ([#27](https://github.com/calogica/dbt-date/pull/27) by @swanderz) diff --git a/dbt_packages/dbt_date/LICENSE b/dbt_packages/dbt_date/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/dbt_packages/dbt_date/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/dbt_packages/dbt_date/README.md b/dbt_packages/dbt_date/README.md new file mode 100644 index 0000000..af7043c --- /dev/null +++ b/dbt_packages/dbt_date/README.md @@ -0,0 +1,768 @@ +# dbt-date + +Extension package for [**dbt**](https://github.com/dbt-labs/dbt) to handle date logic and calendar functionality. + +FYI: this package includes [**dbt-utils**](https://github.com/dbt-labs/dbt-utils) so there"s no need to also import dbt-utils in your local project. (In fact, you may get an error if you do.) + +Include in `packages.yml` + +```yaml +packages: + - package: calogica/dbt_date + version: [">=0.5.0", "<0.6.0"] + # for the latest version tag +``` + +Note: we no longer include `spark_utils` in this package to avoid versioning conflicts. If you are running this package on non-core (Snowflake, BigQuery, Redshift, Postgres) platforms, you will need to use a package like `spark_utils` to shim macros. + +For example, in `packages.yml`, you will need to include the relevant package: + +```yaml + - package: dbt-labs/spark_utils + version: +``` + +And reference in the dispatch list for `dbt_utils` in `dbt_project.yml`: + +```yaml +vars: + dbt_utils_dispatch_list: [spark_utils] +``` + +## Variables + +The following variables need to be defined in your `dbt_project.yml` file: + +```yaml +vars: + "dbt_date:time_zone": "America/Los_Angeles" +``` + +You may specify [any valid timezone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) in place of `America/Los_Angeles`. +For example, use `America/New_York` for East Coast Time. + +## Integration Tests (Developers Only) + +This project contains integration tests for all test macros in a separate `integration_tests` dbt project contained in this repo. + +To run the tests: + +1. You will need a profile called `integration_tests` in `~/.dbt/profiles.yml` pointing to a writable database. We only support postgres, BigQuery and Snowflake. +2. Then, from within the `integration_tests` folder, run `dbt build` to run the test models in `integration_tests/models/schema_tests/` and run the tests specified in `integration_tests/models/schema_tests/schema.yml` + +## Available Tests + +## Available Macros + +### Date Dimension + +- [get_base_dates](#get_base_datesstart_datenone-end_datenone-n_datepartsnone-datepartday) +- [get_date_dimension](#get_date_dimensionstart_date-end_date) + +### Calendar Date + +- [convert_timezone](#convert_timezone-column-target_tznone-source_tznone) +- [date_part](#date_partdatepart-date) +- [day_name](#day_namedate-shorttrue) +- [day_of_month](#day_of_monthdate) +- [day_of_week](#day_of_weekdate-isoweektrue) +- [day_of_year](#day_of_yeardate) +- [from_unixtimestamp](#from_unixtimestampepochs-formatseconds) +- [iso_week_end](#iso_week_enddatenone-tznone) +- [iso_week_of_year](#iso_week_of_yeardatenone-tznone) +- [iso_week_start](#iso_week_startdatenone-tznone) +- [last_month_name](#last_month_nameshorttrue-tznone) +- [last_month_number](#last_month_numbertznone) +- [last_month](#last_monthtznone) +- [last_week](#last_weektznone) +- [month_name](#month_namedate-shorttrue-tznone) +- [n_days_ago](#n_days_agon-datenone-tznone) +- [n_days_away](#n_days_awayn-datenone-tznone) +- [n_months_ago](#n_months_agon-tznone) +- [n_months_away](#n_months_awayn-tznone) +- [n_weeks_ago](#n_weeks_agon-tznone) +- [n_weeks_away](#n_weeks_awayn-tznone) +- [next_month_name](#next_month_nameshorttrue-tznone) +- [next_month_number](#next_month_numbertznone) +- [next_month](#next_monthtznone) +- [next_week](#next_weektznone) +- [now](#nowtznone) +- [periods_since](#periods_sincedate_col-period_nameday-tznone) +- [to_unixtimestamp](#to_unixtimestamptimestamp) +- [today](#todaytznone) +- [tomorrow](#tomorrowdatenone-tznone) +- [week_end](#week_enddatenone-tznone) +- [week_of_year](#week_of_yeardatenone-tznone) +- [week_start](#week_startdatenone-tznone) +- [yesterday](#yesterdaydatenone-tznone) + +## Fiscal Date + +- [get_fiscal_periods](#get_fiscal_periodsdates-year_end_month-week_start_day-shift_year1) + +## Documentation + +### [get_base_dates](macros/get_base_dates.sql)(`start_date=None, end_date=None, n_dateparts=None, datepart="day"`) + +A wrapper around [`dbt_utils.date_spine`](https://github.com/dbt-labs/dbt-utils#date_spine-source) that allows you to specify either `start_date` and `end_date` for your date spine, or specify a number of periods (`n_dateparts`) in the past from today. + +Usage: + +```sql +{{ dbt_date.get_base_dates(start_date="2015-01-01", end_date="2022-12-31") }} +``` + +or to build a daily date dimension for the last 3 years: + +```sql +{{ dbt_date.get_base_dates(n_dateparts=365*3, datepart="day") }} +``` + +### [get_date_dimension](macros/get_date_dimension.sql)(`start_date, end_date`) + +Returns a query to build date dimension from/to specified dates, including a number of useful columns based on each date. +See the [example model](integration_tests/models/dim_date.sql) for details. + +Usage: + +```sql +{{ dbt_date.get_date_dimension("2015-01-01", "2022-12-31") }} +``` + +### Fiscal Periods + +### [get_fiscal_periods](macros/fiscal_date/get_fiscal_periods.sql)(`dates, year_end_month, week_start_day, shift_year=1`) + +Returns a query to build a fiscal period calendar based on the 4-5-4 week retail period concept. +See the [example model](integration_tests/models/dim_date_fiscal.sql) for details and this [blog post](https://calogica.com/sql/dbt/2018/11/15/retail-calendar-in-sql.html) for more context on custom business calendars. + +Usage: + +```sql +{{ dbt_date.get_fiscal_periods(ref("dates"), year_end_month, week_start_day) }} +``` + +Note: the first parameter expects a dbt `ref` variable, i.e. a reference to a model containing the necessary date dimension attributes, which can be generated via the `get_date_dimension` macro (see above). + +### Date + +### [convert_timezone](macros/calendar_date/convert_timezone.sql)( `column, target_tz=None, source_tz=None`) + +Cross-database implemention of convert_timezone function. + +Usage: + +```sql +{{ dbt_date.convert_timezone("my_column") }} +``` + +or, specify a target timezone: + +```sql +{{ dbt_date.convert_timezone("my_column", "America/New_York") }} +``` + +or, also specify a source timezone: + +```sql +{{ dbt_date.convert_timezone("my_column", "America/New_York", "UTC") }} +``` + +Using named parameters, we can also specify the source only and rely on the configuration parameter for the target: + +```sql +{{ dbt_date.convert_timezone("my_column", source_tz="UTC") }} +``` + +### [date_part](macros/calendar_date/date_part.sql)(`datepart, date`) + +Extracts date parts from date. + +Usage: + +```sql +{{ dbt_date.date_part("dayofweek", "date_col") }} as day_of_week +``` + +### [day_name](macros/calendar_date/day_name.sql)(`date, short=True`) + +Extracts name of weekday from date. + +Usage: + +```sql +{{ dbt_date.day_name("date_col") }} as day_of_week_short_name +``` + +```sql +{{ dbt_date.day_name("date_col", short=true) }} as day_of_week_short_name +``` + +```sql +{{ dbt_date.day_name("date_col", short=false) }} as day_of_week_long_name +``` + +### [day_of_month](macros/calendar_date/day_of_month.sql)(`date`) + +Extracts day of the month from a date (e.g. `2022-03-06` --> `6`). + +Usage: + +```sql +{{ dbt_date.day_of_month("date_col") }} as day_of_month +``` + +### [day_of_week](macros/calendar_date/day_of_week.sql)(`date, isoweek=true`) + +Extracts day of the week *number* from a date, starting with **1**. +By default, uses `isoweek=True`, i.e. assumes week starts on *Monday*. + +Usage: + +```sql +{{ dbt_date.day_of_week("'2022-03-06'") }} as day_of_week_iso +``` + +returns: **7** (Sunday is the *last* day of the ISO week) + +```sql +{{ dbt_date.day_of_week("'2022-03-06'", isoweek=False) }} as day_of_week +``` + +returns: **1** (Sunday is the *first* day of the non-ISO week) + +### [day_of_year](macros/calendar_date/day_of_year.sql)(`date`) + +Extracts day of the year from a date (e.g. `2022-02-02` --> `33`). + +Usage: + +```sql +{{ dbt_date.day_of_year("date_col") }} as day_of_year +``` + +or + +```sql +{{ dbt_date.day_of_year("'2022-02-02'") }} as day_of_year +``` + +returns: **33** + +### [from_unixtimestamp](macros/calendar_date/from_unixtimestamp.sql)(`epochs, format="seconds"`) + +Converts an `epoch` into a timestamp. The default for `format` is `seconds`, which can overriden depending your data"s epoch format. + +Usage: + +```sql +{{ dbt_date.from_unixtimestamp("epoch_column") }} as timestamp_column +``` + +```sql +{{ dbt_date.from_unixtimestamp("epoch_column", format="milliseconds") }} as timestamp_column +``` + +See also: [to_unixtimestamp](#to_unixtimestamp) + +### [iso_week_end](macros/calendar_date/iso_week_end.sql)(`date=None, tz=None`) + +Computes the week ending date using ISO format, i.e. week starting **Monday** and ending **Sunday**. + +Usage: + +```sql +{{ dbt_date.iso_week_end("date_col") }} as iso_week_end_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.iso_week_end("date_col", tz="America/New_York") }} as iso_week_end_date +``` + +### [iso_week_of_year](macros/calendar_date/iso_week_of_year.sql)(`date=None, tz=None`) + +Computes the week of the year using ISO format, i.e. week starting **Monday**. + +Usage: + +```sql +{{ dbt_date.iso_week_of_year("date_col") }} as iso_week_of_year +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.iso_week_of_year("date_col", tz="America/New_York") }} as iso_week_of_year +``` + +### [iso_week_start](macros/calendar_date/iso_week_start.sql)(`date=None, tz=None`) + +Computes the week starting date using ISO format, i.e. week starting **Monday**. + +Usage: + +```sql +{{ dbt_date.iso_week_start("date_col") }} as iso_week_start_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.iso_week_start("date_col", tz="America/New_York") }} as iso_week_start_date +``` + +### [last_month_name](macros/calendar_date/last_month_name.sql)(`short=True, tz=None`) + +Extracts the name of the prior month from a date. + +```sql +{{ dbt_date.last_month_name() }} as last_month_short_name +``` + +```sql +{{ dbt_date.last_month_name(short=true) }} as last_month_short_name +``` + +```sql +{{ dbt_date.last_month_name(short=false) }} as last_month_long_name +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.last_month_name(tz="America/New_York") }} as last_month_short_name +``` + +### [last_month_number](macros/calendar_date/last_month_number.sql)(`tz=None`) + +Returns the number of the prior month. + +```sql +{{ dbt_date.last_month_number() }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.last_month_number(tz="America/New_York") }} +``` + +### [last_month](macros/calendar_date/last_month.sql)(`tz=None`) + +Returns the start date of the prior month. + +```sql +{{ dbt_date.last_month() }} as last_month_start_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.last_month(tz="America/New_York") }} as last_month_start_date +``` + +### [last_week](macros/calendar_date/last_week.sql)(`tz=None`) + +Convenience function to get the start date of last week (non-ISO) + +Wraps: + +```sql +{{ dbt_date.n_weeks_ago(1, tz) }} +``` + +Usage: + +```sql +{{ dbt_date.last_week()) }} as last_week_start_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.last_week(tz="America/New_York)) }} as last_week_start_date +``` + +### [month_name](macros/calendar_date/month_name.sql)(`date, short=True, tz=None`) + +Extracts the name of the month from a date. + +```sql +{{ dbt_date.month_name(date_col) }} as month_short_name +``` + +```sql +{{ dbt_date.month_name(date_col, short=true) }} as month_short_name +``` + +```sql +{{ dbt_date.month_name(date_col, short=false) }} as month_long_name +``` + +### [n_days_ago](macros/calendar_date/n_days_ago.sql)(`n, date=None, tz=None`) + +Gets date *n* days ago, based on local date. + +Usage: + +```sql +{{ dbt_date.n_days_ago(7) }} +``` + +Alternatively, you can specify a date column instead of defaulting the local date: + +```sql +{{ dbt_date.n_days_ago(7, date="date_col") }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_days_ago(7, tz="America/New_York)) }} +``` + +### [n_days_away](macros/calendar_date/n_days_away.sql)(`n, date=None, tz=None`) + +Gets date *n* days away, based on local date. + +Usage: + +```sql +{{ dbt_date.n_days_away(7) }} +``` + +Alternatively, you can specify a date column instead of defaulting the local date: + +```sql +{{ dbt_date.n_days_away(7, date="date_col") }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_days_away(7, tz="America/New_York)) }} +``` + +### [n_months_ago](macros/calendar_date/n_months_ago.sql)(`n, tz=None`) + +Gets date *n* months ago, based on local date. + +Usage: + +```sql +{{ dbt_date.n_months_ago(12) }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_months_ago(12, tz="America/New_York)) }} +``` + +### [n_months_away](macros/calendar_date/n_months_away.sql)(`n, tz=None`) + +Gets date *n* months away, based on local date. + +Usage: + +```sql +{{ dbt_date.n_months_ago(12) }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_months_away(12, tz="America/New_York)) }} +``` + +### [n_weeks_ago](macros/calendar_date/n_weeks_ago.sql)(`n, tz=None`) + +Gets date *n* weeks ago, based on local date. + +Usage: + +```sql +{{ dbt_date.n_weeks_ago(12) }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_weeks_ago(12, tz="America/New_York)) }} +``` + +### [n_weeks_away](macros/calendar_date/n_weeks_away.sql)(`n, tz=None`) + +Gets date *n* weeks away, based on local date. + +Usage: + +```sql +{{ dbt_date.n_weeks_away(12) }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.n_weeks_away(12, tz="America/New_York)) }} +``` + +### [next_month_name](macros/calendar_date/next_month_name.sql)(`short=True, tz=None`) + +Extracts the name of the next month from a date. + +```sql +{{ dbt_date.next_month_name() }} as next_month_short_name +``` + +```sql +{{ dbt_date.next_month_name(short=true) }} as next_month_short_name +``` + +```sql +{{ dbt_date.next_month_name(short=false) }} as next_month_long_name +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.next_month_name(tz="America/New_York") }} as next_month_short_name +``` + +### [next_month_number](macros/calendar_date/next_month_number.sql)(`tz=None`) + +Returns the number of the next month. + +```sql +{{ dbt_date.next_month_number() }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.next_month_number(tz="America/New_York") }} +``` + +### [next_month](macros/calendar_date/next_month.sql)(`tz=None`) + +Returns the start date of the next month. + +```sql +{{ dbt_date.next_month() }} as next_month_start_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.next_month(tz="America/New_York") }} as next_month_start_date +``` + +### [next_week](macros/calendar_date/next_week.sql)(`tz=None`) + +Convenience function to get the start date of next week (non-ISO) + +Wraps: + +```sql +{{ dbt_date.n_weeks_away(1, tz) }} +``` + +Usage: + +```sql +{{ dbt_date.next_week()) }} as next_week_start_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.next_week(tz="America/New_York") }} as next_week_start_date +``` + +### [now](macros/calendar_date/now.sql)(`tz=None`) + +Gets current timestamp based on local timezone (specified). Default is "America/Los_Angeles". + +Usage: + +```sql +{{ dbt_date.now() }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.now("America/New_York") }} +``` + +### [periods_since](macros/calendar_date/periods_since.sql)(`date_col, period_name='day', tz=None`) + +Returns the number of periods since a specified date or to `now`. + +Usage: + +```sql +{{ dbt_date.periods_since("my_date_column", period_name="day" }} +``` + +or, + +```sql +{{ dbt_date.periods_since("my_timestamp_column", period_name="minute" }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.periods_since("my_timestamp_column", period_name="minute", tz="UTC" }} +``` + +### [to_unixtimestamp](macros/calendar_date/to_unixtimestamp.sql)(`timestamp`) + +Gets Unix timestamp (epochs) based on provided timestamp. + +Usage: + +```sql +{{ dbt_date.to_unixtimestamp("my_timestamp_column") }} +``` + +```sql +{{ dbt_date.to_unixtimestamp(dbt_date.now()) }} +``` + +### [today](macros/calendar_date/today.sql)(`tz=None`) + +Gets date based on local timezone. + +Usage: + +```sql +{{ dbt_date.today() }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.today("America/New_York") }} +``` + +### [tomorrow](macros/calendar_date/tomorrow.sql)(`date=None, tz=None`) + +Gets tomorrow's date, based on local date. + +Usage: + +```sql +{{ dbt_date.tomorrow() }} +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.tomorrow(tz="America/New_York") }} as date_tomorrow +``` + +Alternatively, you can also override the anchor date from the default `today` to some other date: + +```sql +{{ dbt_date.tomorrow(date="date_col", tz="America/New_York") }} as date_tomorrow +``` + +### [week_end](macros/calendar_date/week_end.sql)(`date=None, tz=None`) + +Computes the week ending date using standard (US) format, i.e. week starting **Sunday**. + +Usage: + +If `date` is not specified, the date anchor defaults to `today`. + +```sql +{{ dbt_date.week_end() }} as week_end_date +``` + +or specify a date (column): + +```sql +{{ dbt_date.week_end("date_col") }} as week_end_date +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.week_end("date_col", tz="America/New_York") }} as week_end_date +``` + +### [week_of_year](macros/calendar_date/week_of_year.sql)(`date=None, tz=None`) + +Computes the week of the year using standard (US) format, i.e. week starting **Sunday** and ending **Saturday**. + +Usage: + +If `date` is not specified, the date anchor defaults to `today`. + +```sql +{{ dbt_date.week_of_year() }} as week_of_year +``` + +or specify a date (column): + +```sql +{{ dbt_date.week_of_year("date_col") }} as week_of_year +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.week_of_year("date_col", tz="America/New_York") }} as week_of_year +``` + +### [week_start](macros/calendar_date/week_start.sql)(`date=None, tz=None`) + +Computes the week starting date using standard (US) format, i.e. week starting **Sunday**. + +Usage: + +If `date` is not specified, the date anchor defaults to `today`. + +```sql +{{ dbt_date.week_start() }} as week_start +``` + +or specify a date (column): + +```sql +{{ dbt_date.week_start("date_col") }} as week_start +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.week_start("date_col", tz="America/New_York") }} as week_start +``` + +### [yesterday](macros/calendar_date/yesterday.sql)(`date=None, tz=None`) + +Gets yesterday's date, based on local date. + +Usage: + +If `date` is not specified, the date anchor defaults to `today`. + +```sql +{{ dbt_date.yesterday() }} as date_yesterday +``` + +or specify a date (column): + +```sql +{{ dbt_date.yesterday("date_col") }} as date_yesterday +``` + +or, optionally, you can override the default timezone: + +```sql +{{ dbt_date.yesterday(tz="America/New_York") }} as date_yesterday +``` diff --git a/dbt_packages/dbt_date/dbt_project.yml b/dbt_packages/dbt_date/dbt_project.yml new file mode 100644 index 0000000..eb95668 --- /dev/null +++ b/dbt_packages/dbt_date/dbt_project.yml @@ -0,0 +1,20 @@ +name: 'dbt_date' +version: '0.5.0' + +config-version: 2 + +target-path: "target" +clean-targets: ["target", "dbt_packages"] +macro-paths: ["macros"] +log-path: "logs" + +require-dbt-version: [">=1.0.0", "<2.0.0"] +profile: integration_tests + +quoting: + identifier: false + schema: false + +vars: + 'dbt_date:time_zone': 'America/Los_Angeles' + diff --git a/dbt_packages/dbt_date/integration_tests/dbt_project.yml b/dbt_packages/dbt_date/integration_tests/dbt_project.yml new file mode 100644 index 0000000..1bf0c8e --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/dbt_project.yml @@ -0,0 +1,32 @@ +name: "dbt_date_integration_tests" +version: "1.0" + +profile: "integration_tests" + +config-version: 2 + +model-paths: ["models"] +test-paths: ["tests"] +seed-paths: ["data"] +macro-paths: ["macros"] + +target-path: "target" +clean-targets: ["target", "dbt_modules", "dbt_packages"] + +dispatch: + - macro_namespace: dbt_date + search_order: ['dbt_date_integration_tests', 'dbt_date'] # enable override + +vars: + dbt_date_dispatch_list: ['dbt_date_integration_tests'] + "dbt_date:time_zone": "America/Los_Angeles" + +quoting: + database: false + identifier: false + schema: false + +models: + dbt_date_integration_tests: + schema: dbt_date_integration_tests + materialized: table diff --git a/dbt_packages/dbt_date/integration_tests/macros/get_custom_schema.sql b/dbt_packages/dbt_date/integration_tests/macros/get_custom_schema.sql new file mode 100644 index 0000000..c1dee32 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/macros/get_custom_schema.sql @@ -0,0 +1,14 @@ +{% macro generate_schema_name(custom_schema_name, node) -%} + + {%- set default_schema = target.schema -%} + {%- if custom_schema_name is none -%} + + {{ default_schema }} + + {%- else -%} + + {{ custom_schema_name | trim }} + + {%- endif -%} + +{%- endmacro %} diff --git a/dbt_packages/dbt_date/integration_tests/macros/get_test_dates.sql b/dbt_packages/dbt_date/integration_tests/macros/get_test_dates.sql new file mode 100644 index 0000000..c7acda6 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/macros/get_test_dates.sql @@ -0,0 +1,89 @@ +{% macro get_test_dates() -%} +select + cast('2020-11-29' as date) as date_day, + cast('2020-11-28' as date) as prior_date_day, + cast('2020-11-30' as date) as next_date_day, + 'Sunday' as day_name, + 'Sun' as day_name_short, + 29 as day_of_month, + 1 as day_of_week, + 7 as iso_day_of_week, + 334 as day_of_year, + cast('2020-11-29' as date) as week_start_date, + cast('2020-12-05' as date) as week_end_date, + {{ get_test_week_of_year()[0] }} as week_of_year, + -- in ISO terms, this is the end of the prior week + cast('2020-11-23' as date) as iso_week_start_date, + cast('2020-11-29' as date) as iso_week_end_date, + 48 as iso_week_of_year, + 'November' as month_name, + 'Nov' as month_name_short, + 1623076520 as unix_epoch, + cast('{{ get_test_timestamps()[0] }}' as {{ dbt_utils.type_timestamp() }}) as time_stamp, + cast('{{ get_test_timestamps()[1] }}' as {{ dbt_utils.type_timestamp() }}) as time_stamp_utc + +union all + +select + cast('2020-12-01' as date) as date_day, + cast('2020-11-30' as date) as prior_date_day, + cast('2020-12-02' as date) as next_date_day, + 'Tuesday' as day_name, + 'Tue' as day_name_short, + 1 as day_of_month, + 3 as day_of_week, + 2 as iso_day_of_week, + 336 as day_of_year, + cast('2020-11-29' as date) as week_start_date, + cast('2020-12-05' as date) as week_end_date, + {{ get_test_week_of_year()[1] }} as week_of_year, + cast('2020-11-30' as date) as iso_week_start_date, + cast('2020-12-06' as date) as iso_week_end_date, + 49 as iso_week_of_year, + 'December' as month_name, + 'Dec' as month_name_short, + {# 1623051320 as unix_epoch, #} + 1623076520 as unix_epoch, + cast('{{ get_test_timestamps()[0] }}' as {{ dbt_utils.type_timestamp() }}) as time_stamp, + cast('{{ get_test_timestamps()[1] }}' as {{ dbt_utils.type_timestamp() }}) as time_stamp_utc + +{%- endmacro %} + +{% macro get_test_week_of_year() -%} + {{ return(adapter.dispatch('get_test_week_of_year', 'dbt_date_integration_tests') ()) }} +{%- endmacro %} + +{% macro default__get_test_week_of_year() -%} + {# weeks_of_year for '2020-11-29' and '2020-12-01', respectively #} + {{ return([48,48]) }} +{%- endmacro %} + +{% macro snowflake__get_test_week_of_year() -%} + {# weeks_of_year for '2020-11-29' and '2020-12-01', respectively #} + {# Snowflake uses ISO year #} + {{ return([48,49]) }} +{%- endmacro %} + + + +{% macro get_test_timestamps() -%} + {{ return(adapter.dispatch('get_test_timestamps', 'dbt_date_integration_tests') ()) }} +{%- endmacro %} + +{% macro default__get_test_timestamps() -%} + {{ return(['2021-06-07 07:35:20.000000 America/Los_Angeles', + '2021-06-07 14:35:20.000000 UTC']) }} +{%- endmacro %} + +{% macro bigquery__get_test_timestamps() -%} + {{ return(['2021-06-07 07:35:20.000000', + '2021-06-07 14:35:20.000000']) }} +{%- endmacro %} + +{% macro snowflake__get_test_timestamps() -%} + {{ return(['2021-06-07 07:35:20.000000 -0700', + '2021-06-07 14:35:20.000000 -0000']) }} +{%- endmacro %} + + + diff --git a/dbt_packages/dbt_date/integration_tests/models/dates.sql b/dbt_packages/dbt_date/integration_tests/models/dates.sql new file mode 100644 index 0000000..29c2158 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/dates.sql @@ -0,0 +1,6 @@ +{{ + config( + materialized = "table" + ) +}} +{{ dbt_date.get_date_dimension('2015-01-01', '2022-12-31') }} diff --git a/dbt_packages/dbt_date/integration_tests/models/dim_date.sql b/dbt_packages/dbt_date/integration_tests/models/dim_date.sql new file mode 100644 index 0000000..5a450f0 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/dim_date.sql @@ -0,0 +1,23 @@ +{{ + config( + materialized = "table" + ) +}} +with date_dimension as ( + select * from {{ ref('dates') }} +), +fiscal_periods as ( + {{ dbt_date.get_fiscal_periods(ref('dates'), year_end_month=1, week_start_day=1, shift_year=1) }} +) +select + d.*, + f.fiscal_week_of_year, + f.fiscal_week_of_period, + f.fiscal_period_number, + f.fiscal_quarter_number, + f.fiscal_period_of_quarter +from + date_dimension d + left join + fiscal_periods f + on d.date_day = f.date_day diff --git a/dbt_packages/dbt_date/integration_tests/models/dim_date_fiscal.sql b/dbt_packages/dbt_date/integration_tests/models/dim_date_fiscal.sql new file mode 100644 index 0000000..4e70022 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/dim_date_fiscal.sql @@ -0,0 +1,12 @@ +{{ + config( + materialized = "table" + ) +}} +with fp as ( + {{ dbt_date.get_fiscal_periods(ref('dates'), year_end_month=1, week_start_day=1) }} +) +select + f.* +from + fp f diff --git a/dbt_packages/dbt_date/integration_tests/models/dim_hour.sql b/dbt_packages/dbt_date/integration_tests/models/dim_hour.sql new file mode 100644 index 0000000..853cc02 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/dim_hour.sql @@ -0,0 +1,12 @@ +{{ + config( + materialized = "table" + ) +}} +with periods_hours as ( + {{ dbt_date.get_base_dates(n_dateparts=24*28, datepart="hour") }} +) +select + d.* +from + periods_hours d diff --git a/dbt_packages/dbt_date/integration_tests/models/dim_week.sql b/dbt_packages/dbt_date/integration_tests/models/dim_week.sql new file mode 100644 index 0000000..7ce62d5 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/dim_week.sql @@ -0,0 +1,12 @@ +{{ + config( + materialized = "table" + ) +}} +with periods_weeks as ( + {{ dbt_date.get_base_dates(n_dateparts=52, datepart="week") }} +) +select + d.* +from + periods_weeks d diff --git a/dbt_packages/dbt_date/integration_tests/models/test_dates.sql b/dbt_packages/dbt_date/integration_tests/models/test_dates.sql new file mode 100644 index 0000000..df7efdd --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/test_dates.sql @@ -0,0 +1,6 @@ +{{ + config( + materialized = 'table' + ) +}} +{{ dbt_date_integration_tests.get_test_dates() }} diff --git a/dbt_packages/dbt_date/integration_tests/models/test_dates.yml b/dbt_packages/dbt_date/integration_tests/models/test_dates.yml new file mode 100644 index 0000000..b321af0 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/models/test_dates.yml @@ -0,0 +1,44 @@ +version: 2 +models: + - name: test_dates + tests: + - dbt_utils.expression_is_true: + expression: "prior_date_day = {{ dbt_date.yesterday('date_day') }}" + - dbt_utils.expression_is_true: + expression: "next_date_day = {{ dbt_date.tomorrow('date_day') }}" + - dbt_utils.expression_is_true: + expression: "day_name = {{ dbt_date.day_name('date_day', short=False) }}" + - dbt_utils.expression_is_true: + expression: "day_name_short = {{ dbt_date.day_name('date_day', short=True) }}" + - dbt_utils.expression_is_true: + expression: "day_of_month = {{ dbt_date.day_of_month('date_day') }}" + - dbt_utils.expression_is_true: + expression: "day_of_week = {{ dbt_date.day_of_week('date_day', isoweek=False) }}" + - dbt_utils.expression_is_true: + expression: "iso_day_of_week = {{ dbt_date.day_of_week('date_day', isoweek=True) }}" + - dbt_utils.expression_is_true: + expression: "day_of_year = {{ dbt_date.day_of_year('date_day') }}" + + - dbt_utils.expression_is_true: + expression: "week_start_date = {{ dbt_date.week_start('date_day') }}" + - dbt_utils.expression_is_true: + expression: "week_end_date = {{ dbt_date.week_end('date_day') }}" + - dbt_utils.expression_is_true: + expression: "week_of_year = {{ dbt_date.week_of_year('date_day') }}" + - dbt_utils.expression_is_true: + expression: "iso_week_start_date = {{ dbt_date.iso_week_start('date_day') }}" + - dbt_utils.expression_is_true: + expression: "iso_week_end_date = {{ dbt_date.iso_week_end('date_day') }}" + - dbt_utils.expression_is_true: + expression: "iso_week_of_year = {{ dbt_date.iso_week_of_year('date_day') }}" + - dbt_utils.expression_is_true: + expression: "time_stamp_utc = {{ dbt_date.from_unixtimestamp('unix_epoch') }}" + - dbt_utils.expression_is_true: + expression: "unix_epoch = {{ dbt_date.to_unixtimestamp('time_stamp_utc') }}" + - dbt_utils.expression_is_true: + expression: "time_stamp = {{ dbt_date.convert_timezone('time_stamp_utc') }}" + + columns: + - name: date_day + - name: prior_date_day + diff --git a/dbt_packages/dbt_date/integration_tests/packages.yml b/dbt_packages/dbt_date/integration_tests/packages.yml new file mode 100644 index 0000000..424d083 --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/packages.yml @@ -0,0 +1,2 @@ +packages: + - local: ../ diff --git a/dbt_packages/dbt_date/integration_tests/test.sh b/dbt_packages/dbt_date/integration_tests/test.sh new file mode 100644 index 0000000..790660c --- /dev/null +++ b/dbt_packages/dbt_date/integration_tests/test.sh @@ -0,0 +1,14 @@ +if [[ $# -gt 0 ]] +then + +i=1; +for t in "$@" +do + + dbt build -t $t + +done + +else + echo "Please specify one or more targets as command-line arguments, i.e. test.sh bq snowflake" +fi diff --git a/dbt_packages/dbt_date/macros/calendar_date/convert_timezone.sql b/dbt_packages/dbt_date/macros/calendar_date/convert_timezone.sql new file mode 100644 index 0000000..9701785 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/convert_timezone.sql @@ -0,0 +1,36 @@ +{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%} +{%- set source_tz = "UTC" if not source_tz else source_tz -%} +{%- set target_tz = var("dbt_date:time_zone") if not target_tz else target_tz -%} +{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }} +{%- endmacro -%} + +{% macro default__convert_timezone(column, target_tz, source_tz) -%} +{%- if not source_tz -%} +cast(convert_timezone('{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }}) +{%- else -%} +cast(convert_timezone('{{ source_tz }}', '{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }}) +{%- endif -%} +{%- endmacro -%} + +{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%} +timestamp(datetime({{ column }}, '{{ target_tz}}')) +{%- endmacro -%} + +{%- macro spark__convert_timezone(column, target_tz, source_tz) -%} +from_utc_timestamp( + to_utc_timestamp({{ column }}, '{{ source_tz }}'), + '{{ target_tz }}' + ) +{%- endmacro -%} + +{% macro postgres__convert_timezone(column, target_tz, source_tz) -%} +{%- if source_tz -%} +cast({{ column }} at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }}) +{%- else -%} +cast({{ column }} at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }}) +{%- endif -%} +{%- endmacro -%} + +{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%} +{{ return(dbt_date.default__convert_timezone(column, target_tz, source_tz)) }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/date_part.sql b/dbt_packages/dbt_date/macros/calendar_date/date_part.sql new file mode 100644 index 0000000..257d97d --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/date_part.sql @@ -0,0 +1,11 @@ +{% macro date_part(datepart, date) -%} + {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }} +{%- endmacro %} + +{% macro default__date_part(datepart, date) -%} + date_part('{{ datepart }}', {{ date }}) +{%- endmacro %} + +{% macro bigquery__date_part(datepart, date) -%} + extract({{ datepart }} from {{ date }}) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/day_name.sql b/dbt_packages/dbt_date/macros/calendar_date/day_name.sql new file mode 100644 index 0000000..2afe962 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/day_name.sql @@ -0,0 +1,37 @@ +{%- macro day_name(date, short=True) -%} + {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }} +{%- endmacro %} + +{%- macro default__day_name(date, short) -%} +{%- set f = 'Dy' if short else 'Day' -%} + to_char({{ date }}, '{{ f }}') +{%- endmacro %} + +{%- macro snowflake__day_name(date, short) -%} + {%- if short -%} + dayname({{ date }}) + {%- else -%} + -- long version not implemented on Snowflake so we're doing it manually :/ + case dayname({{ date }}) + when 'Mon' then 'Monday' + when 'Tue' then 'Tuesday' + when 'Wed' then 'Wednesday' + when 'Thu' then 'Thursday' + when 'Fri' then 'Friday' + when 'Sat' then 'Saturday' + when 'Sun' then 'Sunday' + end + {%- endif -%} + +{%- endmacro %} + +{%- macro bigquery__day_name(date, short) -%} +{%- set f = '%a' if short else '%A' -%} + format_date('{{ f }}', cast({{ date }} as date)) +{%- endmacro %} + +{%- macro postgres__day_name(date, short) -%} +{# FM = Fill mode, which suppresses padding blanks #} +{%- set f = 'FMDy' if short else 'FMDay' -%} + to_char({{ date }}, '{{ f }}') +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/day_of_month.sql b/dbt_packages/dbt_date/macros/calendar_date/day_of_month.sql new file mode 100644 index 0000000..d9157ad --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/day_of_month.sql @@ -0,0 +1,7 @@ +{%- macro day_of_month(date) -%} +{{ dbt_date.date_part('day', date) }} +{%- endmacro %} + +{%- macro redshift__day_of_month(date) -%} +cast({{ dbt_date.date_part('day', date) }} as {{ dbt_utils.type_bigint() }}) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/day_of_week.sql b/dbt_packages/dbt_date/macros/calendar_date/day_of_week.sql new file mode 100644 index 0000000..416fb2c --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/day_of_week.sql @@ -0,0 +1,84 @@ +{%- macro day_of_week(date, isoweek=true) -%} +{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }} +{%- endmacro %} + +{%- macro default__day_of_week(date, isoweek) -%} + + {%- set dow = dbt_date.date_part('dayofweek', date) -%} + + {%- if isoweek -%} + case + -- Shift start of week from Sunday (0) to Monday (1) + when {{ dow }} = 0 then 7 + else {{ dow }} + end + {%- else -%} + {{ dow }} + 1 + {%- endif -%} + +{%- endmacro %} + +{%- macro snowflake__day_of_week(date, isoweek) -%} + + {%- if isoweek -%} + {%- set dow_part = 'dayofweekiso' -%} + {{ dbt_date.date_part(dow_part, date) }} + {%- else -%} + {%- set dow_part = 'dayofweek' -%} + case + when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1 + else {{ dbt_date.date_part(dow_part, date) }} + 1 + end + {%- endif -%} + + + +{%- endmacro %} + +{%- macro bigquery__day_of_week(date, isoweek) -%} + + {%- set dow = dbt_date.date_part('dayofweek', date) -%} + + {%- if isoweek -%} + case + -- Shift start of week from Sunday (1) to Monday (2) + when {{ dow }} = 1 then 7 + else {{ dow }} - 1 + end + {%- else -%} + {{ dow }} + {%- endif -%} + +{%- endmacro %} + + +{%- macro postgres__day_of_week(date, isoweek) -%} + + {%- if isoweek -%} + {%- set dow_part = 'isodow' -%} + -- Monday(1) to Sunday (7) + cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt_utils.type_int() }}) + {%- else -%} + {%- set dow_part = 'dow' -%} + -- Sunday(1) to Saturday (7) + cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt_utils.type_int() }}) + {%- endif -%} + +{%- endmacro %} + + +{%- macro redshift__day_of_week(date, isoweek) -%} + + {%- set dow = dbt_date.date_part('dayofweek', date) -%} + + {%- if isoweek -%} + case + -- Shift start of week from Sunday (0) to Monday (1) + when {{ dow }} = 0 then 7 + else cast({{ dow }} as {{ dbt_utils.type_bigint() }}) + end + {%- else -%} + cast({{ dow }} + 1 as {{ dbt_utils.type_bigint() }}) + {%- endif -%} + +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/day_of_year.sql b/dbt_packages/dbt_date/macros/calendar_date/day_of_year.sql new file mode 100644 index 0000000..86d0df6 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/day_of_year.sql @@ -0,0 +1,15 @@ +{%- macro day_of_year(date) -%} +{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }} +{%- endmacro %} + +{%- macro default__day_of_year(date) -%} + {{ dbt_date.date_part('dayofyear', date) }} +{%- endmacro %} + +{%- macro postgres__day_of_year(date) -%} + {{ dbt_date.date_part('doy', date) }} +{%- endmacro %} + +{%- macro redshift__day_of_year(date) -%} + cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt_utils.type_bigint() }}) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/from_unixtimestamp.sql b/dbt_packages/dbt_date/macros/calendar_date/from_unixtimestamp.sql new file mode 100644 index 0000000..8479298 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/from_unixtimestamp.sql @@ -0,0 +1,55 @@ +{%- macro from_unixtimestamp(epochs, format="seconds") -%} + {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }} +{%- endmacro %} + +{%- macro default__from_unixtimestamp(epochs, format="seconds") -%} + {%- if format != "seconds" -%} + {{ exceptions.raise_compiler_error( + "value " ~ format ~ " for `format` for from_unixtimestamp is not supported." + ) + }} + {% endif -%} + to_timestamp({{ epochs }}) +{%- endmacro %} + +{%- macro postgres__from_unixtimestamp(epochs, format="seconds") -%} + {%- if format != "seconds" -%} + {{ exceptions.raise_compiler_error( + "value " ~ format ~ " for `format` for from_unixtimestamp is not supported." + ) + }} + {% endif -%} + cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp) +{%- endmacro %} + +{%- macro snowflake__from_unixtimestamp(epochs, format) -%} + {%- if format == "seconds" -%} + {%- set scale = 0 -%} + {%- elif format == "milliseconds" -%} + {%- set scale = 3 -%} + {%- elif format == "microseconds" -%} + {%- set scale = 6 -%} + {%- else -%} + {{ exceptions.raise_compiler_error( + "value " ~ format ~ " for `format` for from_unixtimestamp is not supported." + ) + }} + {% endif -%} + to_timestamp_ntz({{ epochs }}, {{ scale }}) + +{%- endmacro %} + +{%- macro bigquery__from_unixtimestamp(epochs, format) -%} + {%- if format == "seconds" -%} + timestamp_seconds({{ epochs }}) + {%- elif format == "milliseconds" -%} + timestamp_millis({{ epochs }}) + {%- elif format == "microseconds" -%} + timestamp_micros({{ epochs }}) + {%- else -%} + {{ exceptions.raise_compiler_error( + "value " ~ format ~ " for `format` for from_unixtimestamp is not supported." + ) + }} + {% endif -%} +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/iso_week_end.sql b/dbt_packages/dbt_date/macros/calendar_date/iso_week_end.sql new file mode 100644 index 0000000..3fa4125 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/iso_week_end.sql @@ -0,0 +1,18 @@ +{%- macro iso_week_end(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro _iso_week_end(date, week_type) -%} +{%- set dt = dbt_date.iso_week_start(date) -%} +{{ dbt_date.n_days_away(6, dt) }} +{%- endmacro %} + +{%- macro default__iso_week_end(date) -%} +{{ dbt_date._iso_week_end(date, 'isoweek') }} +{%- endmacro %} + +{%- macro snowflake__iso_week_end(date) -%} +{{ dbt_date._iso_week_end(date, 'weekiso') }} +{%- endmacro %} + diff --git a/dbt_packages/dbt_date/macros/calendar_date/iso_week_of_year.sql b/dbt_packages/dbt_date/macros/calendar_date/iso_week_of_year.sql new file mode 100644 index 0000000..69c27dc --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/iso_week_of_year.sql @@ -0,0 +1,21 @@ +{%- macro iso_week_of_year(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro _iso_week_of_year(date, week_type) -%} +cast({{ dbt_date.date_part(week_type, date) }} as {{ dbt_utils.type_int() }}) +{%- endmacro %} + +{%- macro default__iso_week_of_year(date) -%} +{{ dbt_date._iso_week_of_year(date, 'isoweek') }} +{%- endmacro %} + +{%- macro snowflake__iso_week_of_year(date) -%} +{{ dbt_date._iso_week_of_year(date, 'weekiso') }} +{%- endmacro %} + +{%- macro postgres__iso_week_of_year(date) -%} +-- postgresql week is isoweek, the first week of a year containing January 4 of that year. +{{ dbt_date._iso_week_of_year(date, 'week') }} +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/iso_week_start.sql b/dbt_packages/dbt_date/macros/calendar_date/iso_week_start.sql new file mode 100644 index 0000000..32737b6 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/iso_week_start.sql @@ -0,0 +1,20 @@ +{%- macro iso_week_start(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro _iso_week_start(date, week_type) -%} +cast({{ dbt_utils.date_trunc(week_type, date) }} as date) +{%- endmacro %} + +{%- macro default__iso_week_start(date) -%} +{{ dbt_date._iso_week_start(date, 'isoweek') }} +{%- endmacro %} + +{%- macro snowflake__iso_week_start(date) -%} +{{ dbt_date._iso_week_start(date, 'week') }} +{%- endmacro %} + +{%- macro postgres__iso_week_start(date) -%} +{{ dbt_date._iso_week_start(date, 'week') }} +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/last_month.sql b/dbt_packages/dbt_date/macros/calendar_date/last_month.sql new file mode 100644 index 0000000..e9b0cb9 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/last_month.sql @@ -0,0 +1,3 @@ +{%- macro last_month(tz=None) -%} +{{ dbt_date.n_months_ago(1, tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/last_month_name.sql b/dbt_packages/dbt_date/macros/calendar_date/last_month_name.sql new file mode 100644 index 0000000..fc2e762 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/last_month_name.sql @@ -0,0 +1,3 @@ +{%- macro last_month_name(short=True, tz=None) -%} +{{ dbt_date.month_name(dbt_date.last_month(1, tz), short=short) }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/last_month_number.sql b/dbt_packages/dbt_date/macros/calendar_date/last_month_number.sql new file mode 100644 index 0000000..9e5b164 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/last_month_number.sql @@ -0,0 +1,3 @@ +{%- macro last_month_number(tz=None) -%} +{{ dbt_date.date_part('month', dbt_date.last_month(1, tz)) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/last_week.sql b/dbt_packages/dbt_date/macros/calendar_date/last_week.sql new file mode 100644 index 0000000..99e4658 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/last_week.sql @@ -0,0 +1,3 @@ +{%- macro last_week(tz=None) -%} +{{ dbt_date.n_weeks_ago(1, tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/month_name.sql b/dbt_packages/dbt_date/macros/calendar_date/month_name.sql new file mode 100644 index 0000000..ddaa164 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/month_name.sql @@ -0,0 +1,24 @@ +{%- macro month_name(date, short=True) -%} + {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }} +{%- endmacro %} + +{%- macro default__month_name(date, short) -%} +{%- set f = 'MON' if short else 'MONTH' -%} + to_char({{ date }}, '{{ f }}') +{%- endmacro %} + +{%- macro bigquery__month_name(date, short) -%} +{%- set f = '%b' if short else '%B' -%} + format_date('{{ f }}', cast({{ date }} as date)) +{%- endmacro %} + +{%- macro snowflake__month_name(date, short) -%} +{%- set f = 'MON' if short else 'MMMM' -%} + to_char({{ date }}, '{{ f }}') +{%- endmacro %} + +{%- macro postgres__month_name(date, short) -%} +{# FM = Fill mode, which suppresses padding blanks #} +{%- set f = 'FMMon' if short else 'FMMonth' -%} + to_char({{ date }}, '{{ f }}') +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_days_ago.sql b/dbt_packages/dbt_date/macros/calendar_date/n_days_ago.sql new file mode 100644 index 0000000..2ea64b0 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_days_ago.sql @@ -0,0 +1,5 @@ +{%- macro n_days_ago(n, date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{%- set n = n|int -%} +cast({{ dbt_utils.dateadd('day', -1 * n, dt) }} as date) +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_days_away.sql b/dbt_packages/dbt_date/macros/calendar_date/n_days_away.sql new file mode 100644 index 0000000..2cdcb64 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_days_away.sql @@ -0,0 +1,3 @@ +{%- macro n_days_away(n, date=None, tz=None) -%} +{{ dbt_date.n_days_ago(-1 * n, date, tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_months_ago.sql b/dbt_packages/dbt_date/macros/calendar_date/n_months_ago.sql new file mode 100644 index 0000000..4693be9 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_months_ago.sql @@ -0,0 +1,8 @@ +{%- macro n_months_ago(n, tz=None) -%} +{%- set n = n|int -%} +{{ dbt_utils.date_trunc('month', + dbt_utils.dateadd('month', -1 * n, + dbt_date.today(tz) + ) + ) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_months_away.sql b/dbt_packages/dbt_date/macros/calendar_date/n_months_away.sql new file mode 100644 index 0000000..f21a6ab --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_months_away.sql @@ -0,0 +1,8 @@ +{%- macro n_months_away(n, tz=None) -%} +{%- set n = n|int -%} +{{ dbt_utils.date_trunc('month', + dbt_utils.dateadd('month', n, + dbt_date.today(tz) + ) + ) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_weeks_ago.sql b/dbt_packages/dbt_date/macros/calendar_date/n_weeks_ago.sql new file mode 100644 index 0000000..9c61384 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_weeks_ago.sql @@ -0,0 +1,8 @@ +{%- macro n_weeks_ago(n, tz=None) -%} +{%- set n = n|int -%} +{{ dbt_utils.date_trunc('week', + dbt_utils.dateadd('week', -1 * n, + dbt_date.today(tz) + ) + ) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/n_weeks_away.sql b/dbt_packages/dbt_date/macros/calendar_date/n_weeks_away.sql new file mode 100644 index 0000000..5843fff --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/n_weeks_away.sql @@ -0,0 +1,8 @@ +{%- macro n_weeks_away(n, tz=None) -%} +{%- set n = n|int -%} +{{ dbt_utils.date_trunc('week', + dbt_utils.dateadd('week', n, + dbt_date.today(tz) + ) + ) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/next_month.sql b/dbt_packages/dbt_date/macros/calendar_date/next_month.sql new file mode 100644 index 0000000..eda74e4 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/next_month.sql @@ -0,0 +1,3 @@ +{%- macro next_month(tz=None) -%} +{{ dbt_date.n_months_away(1, tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/next_month_name.sql b/dbt_packages/dbt_date/macros/calendar_date/next_month_name.sql new file mode 100644 index 0000000..d0b29ee --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/next_month_name.sql @@ -0,0 +1,3 @@ +{%- macro next_month_name(short=True, tz=None) -%} +{{ dbt_date.month_name(dbt_date.next_month(1, tz), short=short) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/next_month_number.sql b/dbt_packages/dbt_date/macros/calendar_date/next_month_number.sql new file mode 100644 index 0000000..a1a5e24 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/next_month_number.sql @@ -0,0 +1,3 @@ +{%- macro next_month_number(tz=None) -%} +{{ dbt_date.date_part('month', dbt_date.next_month(1, tz)) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/next_week.sql b/dbt_packages/dbt_date/macros/calendar_date/next_week.sql new file mode 100644 index 0000000..bfb7569 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/next_week.sql @@ -0,0 +1,3 @@ +{%- macro next_week(tz=None) -%} +{{ dbt_date.n_weeks_away(1, tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/now.sql b/dbt_packages/dbt_date/macros/calendar_date/now.sql new file mode 100644 index 0000000..66140ca --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/now.sql @@ -0,0 +1,3 @@ +{%- macro now(tz=None) -%} +{{ dbt_date.convert_timezone(dbt_utils.current_timestamp(), tz) }} +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/calendar_date/periods_since.sql b/dbt_packages/dbt_date/macros/calendar_date/periods_since.sql new file mode 100644 index 0000000..ffd56b3 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/periods_since.sql @@ -0,0 +1,3 @@ +{%- macro periods_since(date_col, period_name='day', tz=None) -%} +{{ dbt_utils.datediff(date_col, dbt_date.now(tz), period_name) }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/to_unixtimestamp.sql b/dbt_packages/dbt_date/macros/calendar_date/to_unixtimestamp.sql new file mode 100644 index 0000000..6c9bbfb --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/to_unixtimestamp.sql @@ -0,0 +1,15 @@ +{%- macro to_unixtimestamp(timestamp) -%} + {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }} +{%- endmacro %} + +{%- macro default__to_unixtimestamp(timestamp) -%} + {{ dbt_date.date_part('epoch', timestamp) }} +{%- endmacro %} + +{%- macro snowflake__to_unixtimestamp(timestamp) -%} + {{ dbt_date.date_part('epoch_seconds', timestamp) }} +{%- endmacro %} + +{%- macro bigquery__to_unixtimestamp(timestamp) -%} + unix_seconds({{ timestamp }}) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/today.sql b/dbt_packages/dbt_date/macros/calendar_date/today.sql new file mode 100644 index 0000000..c2ec55a --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/today.sql @@ -0,0 +1,3 @@ +{%- macro today(tz=None) -%} +cast({{ dbt_date.now(tz) }} as date) +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/tomorrow.sql b/dbt_packages/dbt_date/macros/calendar_date/tomorrow.sql new file mode 100644 index 0000000..564dd75 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/tomorrow.sql @@ -0,0 +1,3 @@ +{%- macro tomorrow(date=None, tz=None) -%} +{{ dbt_date.n_days_away(1, date, tz) }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/calendar_date/week_end.sql b/dbt_packages/dbt_date/macros/calendar_date/week_end.sql new file mode 100644 index 0000000..ec046d0 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/week_end.sql @@ -0,0 +1,18 @@ +{%- macro week_end(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('week_end', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro default__week_end(date) -%} +{{ dbt_utils.last_day(date, 'week') }} +{%- endmacro %} + +{%- macro snowflake__week_end(date) -%} +{%- set dt = dbt_date.week_start(date) -%} +{{ dbt_date.n_days_away(6, dt) }} +{%- endmacro %} + +{%- macro postgres__week_end(date) -%} +{%- set dt = dbt_date.week_start(date) -%} +{{ dbt_date.n_days_away(6, dt) }} +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/week_of_year.sql b/dbt_packages/dbt_date/macros/calendar_date/week_of_year.sql new file mode 100644 index 0000000..787b0fa --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/week_of_year.sql @@ -0,0 +1,14 @@ +{%- macro week_of_year(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro default__week_of_year(date) -%} +cast({{ dbt_date.date_part('week', date) }} as {{ dbt_utils.type_int() }}) +{%- endmacro %} + +{%- macro postgres__week_of_year(date) -%} +{# postgresql 'week' returns isoweek. Use to_char instead. + WW = the first week starts on the first day of the year #} +cast(to_char({{ date }}, 'WW') as {{ dbt_utils.type_int() }}) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/week_start.sql b/dbt_packages/dbt_date/macros/calendar_date/week_start.sql new file mode 100644 index 0000000..13e02d0 --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/week_start.sql @@ -0,0 +1,22 @@ +{%- macro week_start(date=None, tz=None) -%} +{%-set dt = date if date else dbt_date.today(tz) -%} +{{ adapter.dispatch('week_start', 'dbt_date') (dt) }} +{%- endmacro -%} + +{%- macro default__week_start(date) -%} +cast({{ dbt_utils.date_trunc('week', date) }} as date) +{%- endmacro %} + +{%- macro snowflake__week_start(date) -%} + {# + Get the day of week offset: e.g. if the date is a Sunday, + dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset + #} + {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ " - 1" %} + cast({{ dbt_utils.dateadd("day", "-1 * (" ~ off_set ~ ")", date) }} as date) +{%- endmacro %} + +{%- macro postgres__week_start(date) -%} +-- Sunday as week start date +cast({{ dbt_utils.dateadd('day', -1, dbt_utils.date_trunc('week', dbt_utils.dateadd('day', 1, date))) }} as date) +{%- endmacro %} diff --git a/dbt_packages/dbt_date/macros/calendar_date/yesterday.sql b/dbt_packages/dbt_date/macros/calendar_date/yesterday.sql new file mode 100644 index 0000000..cfcdc6d --- /dev/null +++ b/dbt_packages/dbt_date/macros/calendar_date/yesterday.sql @@ -0,0 +1,3 @@ +{%- macro yesterday(date=None, tz=None) -%} +{{ dbt_date.n_days_ago(1, date, tz) }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_periods.sql b/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_periods.sql new file mode 100644 index 0000000..552da23 --- /dev/null +++ b/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_periods.sql @@ -0,0 +1,72 @@ +{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %} +{# +This macro requires you to pass in a ref to a date dimension, created via +dbt_date.get_date_dimension()s +#} +with fscl_year_dates_for_periods as ( + {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }} +), +fscl_year_w13 as ( + + select + f.*, + -- We count the weeks in a 13 week period + -- and separate the 4-5-4 week sequences + mod(cast( + (f.fiscal_week_of_year-1) as {{ dbt_utils.type_int() }} + ), 13) as w13_number, + -- Chop weeks into 13 week merch quarters + cast( + least( + floor((f.fiscal_week_of_year-1)/13.0) + , 3) + as {{ dbt_utils.type_int() }}) as quarter_number + from + fscl_year_dates_for_periods f + +), +fscl_periods as ( + + select + f.date_day, + f.fiscal_year_number, + f.week_start_date, + f.week_end_date, + f.fiscal_week_of_year, + case + -- we move week 53 into the 3rd period of the quarter + when f.fiscal_week_of_year = 53 then 3 + when f.w13_number between 0 and 3 then 1 + when f.w13_number between 4 and 8 then 2 + when f.w13_number between 9 and 12 then 3 + end as period_of_quarter, + f.quarter_number + from + fscl_year_w13 f + +), +fscl_periods_quarters as ( + + select + f.*, + cast(( + (f.quarter_number * 3) + f.period_of_quarter + ) as {{ dbt_utils.type_int() }}) as fiscal_period_number + from + fscl_periods f + +) +select + date_day, + fiscal_year_number, + week_start_date, + week_end_date, + fiscal_week_of_year, + dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period, + fiscal_period_number, + quarter_number+1 as fiscal_quarter_number, + period_of_quarter as fiscal_period_of_quarter +from + fscl_periods_quarters +order by 1,2 +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_year_dates.sql b/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_year_dates.sql new file mode 100644 index 0000000..b4e760d --- /dev/null +++ b/dbt_packages/dbt_date/macros/fiscal_date/get_fiscal_year_dates.sql @@ -0,0 +1,108 @@ +{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %} +{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }} +{% endmacro %} + +{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %} +-- this gets all the dates within a fiscal year +-- determined by the given year-end-month +-- ending on the saturday closest to that month's end date +with date_dimension as ( + select * from {{ dates }} +), +year_month_end as ( + + select + d.year_number - {{ shift_year }} as fiscal_year_number, + d.month_end_date + from + date_dimension d + where + d.month_of_year = {{ year_end_month }} + group by 1,2 + +), +weeks as ( + + select + d.year_number, + d.month_of_year, + d.date_day as week_start_date, + cast({{ dbt_utils.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date + from + date_dimension d + where + d.day_of_week = {{ week_start_day }} + +), +-- get all the weeks that start in the month the year ends +year_week_ends as ( + + select + d.year_number - {{ shift_year }} as fiscal_year_number, + d.week_end_date + from + weeks d + where + d.month_of_year = {{ year_end_month }} + group by + 1,2 + +), +-- then calculate which Saturday is closest to month end +weeks_at_month_end as ( + + select + d.fiscal_year_number, + d.week_end_date, + m.month_end_date, + rank() over + (partition by d.fiscal_year_number + order by + abs({{ dbt_utils.datediff('d.week_end_date', 'm.month_end_date', 'day') }}) + + ) as closest_to_month_end + from + year_week_ends d + join + year_month_end m on d.fiscal_year_number = m.fiscal_year_number +), +fiscal_year_range as ( + + select + w.fiscal_year_number, + cast( + {{ dbt_utils.dateadd('day', 1, + 'lag(w.week_end_date) over(order by w.week_end_date)') }} + as date) as fiscal_year_start_date, + w.week_end_date as fiscal_year_end_date + from + weeks_at_month_end w + where + w.closest_to_month_end = 1 + +), +fiscal_year_dates as ( + + select + d.date_day, + m.fiscal_year_number, + m.fiscal_year_start_date, + m.fiscal_year_end_date, + w.week_start_date, + w.week_end_date, + -- we reset the weeks of the year starting with the merch year start date + dense_rank() + over( + partition by m.fiscal_year_number + order by w.week_start_date + ) as fiscal_week_of_year + from + date_dimension d + join + fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date + join + weeks w on d.date_day between w.week_start_date and w.week_end_date + +) +select * from fiscal_year_dates order by 1 +{% endmacro %} diff --git a/dbt_packages/dbt_date/macros/get_base_dates.sql b/dbt_packages/dbt_date/macros/get_base_dates.sql new file mode 100644 index 0000000..8c67197 --- /dev/null +++ b/dbt_packages/dbt_date/macros/get_base_dates.sql @@ -0,0 +1,61 @@ +{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart="day") %} + {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }} +{% endmacro %} + +{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %} + +{%- if start_date and end_date -%} +{%- set start_date="cast('" ~ start_date ~ "' as " ~ dbt_utils.type_timestamp() ~ ")" -%} +{%- set end_date="cast('" ~ end_date ~ "' as " ~ dbt_utils.type_timestamp() ~ ")" -%} + +{%- elif n_dateparts and datepart -%} + +{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%} +{%- set end_date = dbt_date.tomorrow() -%} +{%- endif -%} + +with date_spine as +( + + {{ dbt_utils.date_spine( + datepart=datepart, + start_date=start_date, + end_date=end_date, + ) + }} + +) +select + cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }} +from + date_spine d +{% endmacro %} + +{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %} + +{%- if start_date and end_date -%} +{%- set start_date="cast('" ~ start_date ~ "' as date )" -%} +{%- set end_date="cast('" ~ end_date ~ "' as date )" -%} + +{%- elif n_dateparts and datepart -%} + +{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%} +{%- set end_date = dbt_date.tomorrow() -%} +{%- endif -%} + +with date_spine as +( + + {{ dbt_utils.date_spine( + datepart=datepart, + start_date=start_date, + end_date=end_date, + ) + }} + +) +select + cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }} +from + date_spine d +{% endmacro %} diff --git a/dbt_packages/dbt_date/macros/get_date_dimension.sql b/dbt_packages/dbt_date/macros/get_date_dimension.sql new file mode 100644 index 0000000..06ea8b7 --- /dev/null +++ b/dbt_packages/dbt_date/macros/get_date_dimension.sql @@ -0,0 +1,132 @@ +{% macro get_date_dimension(start_date, end_date) %} + {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }} +{% endmacro %} + +{% macro default__get_date_dimension(start_date, end_date) %} +with base_dates as ( + {{ dbt_date.get_base_dates(start_date, end_date) }} +), +dates_with_prior_year_dates as ( + + select + cast(d.date_day as date) as date_day, + cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day, + cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day + from + base_dates d + +) +select + d.date_day, + {{ dbt_date.yesterday('d.date_day') }} as prior_date_day, + {{ dbt_date.tomorrow('d.date_day') }} as next_date_day, + d.prior_year_date_day as prior_year_date_day, + d.prior_year_over_year_date_day, + {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week, + {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso, + {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name, + {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short, + {{ dbt_date.day_of_month('d.date_day') }} as day_of_month, + {{ dbt_date.day_of_year('d.date_day') }} as day_of_year, + + {{ dbt_date.week_start('d.date_day') }} as week_start_date, + {{ dbt_date.week_end('d.date_day') }} as week_end_date, + {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date, + {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date, + {{ dbt_date.week_of_year('d.date_day') }} as week_of_year, + + {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date, + {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date, + {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date, + {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date, + {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year, + + {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year, + {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year, + + cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year, + {{ dbt_date.month_name('d.date_day', short=false) }} as month_name, + {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short, + + cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date, + cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date, + + cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date, + cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date, + + cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year, + cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date, + cast({{ dbt_utils.last_day('d.date_day', 'quarter') }} as date) as quarter_end_date, + + cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number, + cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date, + cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date +from + dates_with_prior_year_dates d +order by 1 +{% endmacro %} + +{% macro postgres__get_date_dimension(start_date, end_date) %} +with base_dates as ( + {{ dbt_date.get_base_dates(start_date, end_date) }} +), +dates_with_prior_year_dates as ( + + select + cast(d.date_day as date) as date_day, + cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day, + cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day + from + base_dates d + +) +select + d.date_day, + {{ dbt_date.yesterday('d.date_day') }} as prior_date_day, + {{ dbt_date.tomorrow('d.date_day') }} as next_date_day, + d.prior_year_date_day as prior_year_date_day, + d.prior_year_over_year_date_day, + {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week, + + {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name, + {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short, + {{ dbt_date.day_of_month('d.date_day') }} as day_of_month, + {{ dbt_date.day_of_year('d.date_day') }} as day_of_year, + + {{ dbt_date.week_start('d.date_day') }} as week_start_date, + {{ dbt_date.week_end('d.date_day') }} as week_end_date, + {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date, + {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date, + {{ dbt_date.week_of_year('d.date_day') }} as week_of_year, + + {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date, + {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date, + {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date, + {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date, + {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year, + + {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year, + {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year, + + cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year, + {{ dbt_date.month_name('d.date_day', short=false) }} as month_name, + {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short, + + cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date, + cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date, + + cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date, + cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date, + + cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year, + cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date, + {# dbt_utils.last_day does not support quarter because postgresql does not support quarter interval. #} + cast({{dbt_utils.dateadd('day', '-1', dbt_utils.dateadd('month', '3', dbt_utils.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date, + + cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number, + cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date, + cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date +from + dates_with_prior_year_dates d +order by 1 +{% endmacro %} diff --git a/dbt_packages/dbt_date/packages.yml b/dbt_packages/dbt_date/packages.yml new file mode 100644 index 0000000..538aeec --- /dev/null +++ b/dbt_packages/dbt_date/packages.yml @@ -0,0 +1,3 @@ +packages: + - package: dbt-labs/dbt_utils + version: [">=0.8.0", "<0.9.0"] diff --git a/dbt_packages/dbt_date/profiles.yml b/dbt_packages/dbt_date/profiles.yml new file mode 100644 index 0000000..b23811a --- /dev/null +++ b/dbt_packages/dbt_date/profiles.yml @@ -0,0 +1,38 @@ +config: + partial_parse: True + send_anonymous_usage_stats: False + +integration_tests: + outputs: + postgres: + type: postgres + host: postgres + user: postgres + pass: postgres + dbname: postgres + schema: test + port: 5432 + + bq: + type: bigquery + method: service-account + keyfile: "{{ env_var('DBT_GOOGLE_BIGQUERY_KEYFILE') }}" + project: "{{ env_var('DBT_GOOGLE_PROJECT') }}" + dataset: "{{ env_var('DBT_GOOGLE_BIGQUERY_DATASET') }}" + threads: 8 + timeout_seconds: 300 + priority: interactive + + snowflake: + type: snowflake + account: "{{ env_var('DBT_SNOWFLAKE_ACCOUNT') }}" + user: "{{ env_var('DBT_SNOWFLAKE_USER') }}" + password: "{{ env_var('DBT_SNOWFLAKE_PASSWORD') }}" + role: "{{ env_var('DBT_SNOWFLAKE_ROLE') }}" + database: "{{ env_var('DBT_SNOWFLAKE_DATABASE') }}" + warehouse: "{{ env_var('DBT_SNOWFLAKE_WAREHOUSE') }}" + schema: "{{ env_var('DBT_SNOWFLAKE_SCHEMA') }}" + threads: 8 + client_session_keep_alive: False + + target: bq diff --git a/dbt_packages/dbt_expectations/.circleci/config.yml b/dbt_packages/dbt_expectations/.circleci/config.yml new file mode 100644 index 0000000..740e157 --- /dev/null +++ b/dbt_packages/dbt_expectations/.circleci/config.yml @@ -0,0 +1,77 @@ +version: 2.1 + +jobs: + + integration-tests: + docker: + - image: cimg/python:3.9.9 + - image: cimg/postgres:14.0 + + resource_class: small + + environment: + DBT_PROFILES_DIR: ./integration_tests/ci + DBT_PROJECT_DIR: ./integration_tests + BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" + + steps: + - checkout + - run: + name: Install Python packages + command: | + python3 -m venv venv + . venv/bin/activate + pip install -U pip setuptools wheel + pip install dbt-core dbt-postgres dbt-bigquery dbt-snowflake + + - run: + name: Install dbt dependencies + command: | + . venv/bin/activate + dbt deps --project-dir $DBT_PROJECT_DIR + + - run: + name: "Run Tests - Postgres" + environment: + POSTGRES_HOST: localhost + POSTGRES_TEST_USER: postgres + POSTGRES_TEST_PASSWORD: '' + POSTGRES_TEST_PORT: 5432 + POSTGRES_TEST_DATABASE: circle_test + command: | + . venv/bin/activate + dbt build -t postgres --project-dir $DBT_PROJECT_DIR + + - run: + name: "Set up GCP credentials" + command: | + echo "Writing to $BIGQUERY_SERVICE_KEY_PATH" + echo $BIGQUERY_SERVICE_KEY > $BIGQUERY_SERVICE_KEY_PATH + FILESIZE=$(stat -c%s "$BIGQUERY_SERVICE_KEY_PATH") + echo "Size of $BIGQUERY_SERVICE_KEY_PATH = $FILESIZE bytes." + echo "BIGQUERY_TEST_DATABASE = $BIGQUERY_TEST_DATABASE" + + - run: + name: "Run Tests - BigQuery" + command: | + . venv/bin/activate + dbt build -t bigquery --project-dir $DBT_PROJECT_DIR + + - run: + name: "Run Tests - Snowflake" + command: | + . venv/bin/activate + dbt build -t snowflake --project-dir $DBT_PROJECT_DIR + + - store_artifacts: + path: ./logs + +workflows: + version: 2 + test-all: + jobs: + - hold: + type: approval + - integration-tests: + requires: + - hold diff --git a/dbt_packages/dbt_expectations/.editorconfig b/dbt_packages/dbt_expectations/.editorconfig new file mode 100644 index 0000000..321ab6d --- /dev/null +++ b/dbt_packages/dbt_expectations/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yml,yaml}] +indent_size = 2 diff --git a/dbt_packages/dbt_expectations/.github/FUNDING.yml b/dbt_packages/dbt_expectations/.github/FUNDING.yml new file mode 100644 index 0000000..406a298 --- /dev/null +++ b/dbt_packages/dbt_expectations/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [calogica] diff --git a/dbt_packages/dbt_expectations/.gitignore b/dbt_packages/dbt_expectations/.gitignore new file mode 100644 index 0000000..83beff7 --- /dev/null +++ b/dbt_packages/dbt_expectations/.gitignore @@ -0,0 +1,5 @@ + +target/ +dbt_packages/ +logs/ +.python-version diff --git a/dbt_packages/dbt_expectations/.sponsors/lightdash.jpg b/dbt_packages/dbt_expectations/.sponsors/lightdash.jpg new file mode 100644 index 0000000..08f82c1 Binary files /dev/null and b/dbt_packages/dbt_expectations/.sponsors/lightdash.jpg differ diff --git a/dbt_packages/dbt_expectations/CHANGELOG.md b/dbt_packages/dbt_expectations/CHANGELOG.md new file mode 100644 index 0000000..cb362e6 --- /dev/null +++ b/dbt_packages/dbt_expectations/CHANGELOG.md @@ -0,0 +1,222 @@ +# dbt-expectations v0.5.8 + +## Fixes +* Fixed timestamp comparisons in expect_grouped_row_values_to_have_recent_data by @clausherther in https://github.com/calogica/dbt-expectations/pull/179 + +# dbt-expectations v0.5.7 + +## Documentation +* Add example for dynamic date params in expect_row_values_to_have_data_for_every_n_datepart by @clausherther in https://github.com/calogica/dbt-expectations/pull/174 + +## Fixes +* Fix take_diff syntax in moving stddev test by @karanhegde in https://github.com/calogica/dbt-expectations/pull/178 + +# dbt-expectations v0.5.6 + +**Patch Release** + +## Fixes +* Fix `expect_compound_columns_to_be_unique` to properly handle `ignore_row_if` by @clausherther in https://github.com/calogica/dbt-expectations/pull/171 + + +# dbt-expectations v0.5.5 + +## New Features +* Add automated integration testing with CircleCI in https://github.com/calogica/dbt-expectations/pull/161 +* Show `group_by` columns in validation errors for column increasing test by @dluftspring in https://github.com/calogica/dbt-expectations/pull/158 +* Add `exclusion_condition` to `expect_row_values_to_have_data_for_every_n_datepart` by @gofford in https://github.com/calogica/dbt-expectations/pull/141 + +## Fixes +* Set flakey integration tests to `warn` in https://github.com/calogica/dbt-expectations/pull/162 + + +# dbt-expectations v0.5.4 + +## New Features +* Adds test for column presence by @rcaddell in https://github.com/calogica/dbt-expectations/pull/149 + +## Fixes +* Fix emails.sql by @clausherther in https://github.com/calogica/dbt-expectations/pull/153 +* Fix expect_row_values_to_have_recent_data issues on bigquery by @clausherther in https://github.com/calogica/dbt-expectations/pull/147 + +## New Contributors +* @rcaddell made their first contribution in https://github.com/calogica/dbt-expectations/pull/149 + +# dbt-expectations v0.5.3 + +## New Features +* Add `group_by` parameter to `expect_column_values_to_be_increasing` and `expect_column_values_to_be_decreasing` ([#146](https://github.com/calogica/dbt-expectations/pull/146) @Lucasthenoob) + + +# dbt-expectations v0.5.2 + +## Fixes +* Fix `expect_row_values_to_have_recent_data` to use current timestamp by @MrJoosh in https://github.com/calogica/dbt-expectations/pull/145 (also fixes https://github.com/calogica/dbt-expectations/issues/104) + +## New Features +* Add new `expect_column_values_to_have_consistent_casing` test by @agusfigueroa-htg in https://github.com/calogica/dbt-expectations/pull/138 + +## Doc Updates 💌 +* Update README.md by @kdw2126 in https://github.com/calogica/dbt-expectations/pull/134 +* Fix documentation to note DBT 1.0.0 compatibility by @kdw2126 in https://github.com/calogica/dbt-expectations/pull/136 + +## New Contributors +* @kdw2126 made their first contribution in https://github.com/calogica/dbt-expectations/pull/134 +* @agusfigueroa-htg made their first contribution in https://github.com/calogica/dbt-expectations/pull/138 +* @MrJoosh made their first contribution in https://github.com/calogica/dbt-expectations/pull/145 + + +# dbt-expectations v0.5.1 + +## Fixes +* Add better support for Redshift by typing implicit `varchar` fields explicitly to strings. ([#131](https://github.com/calogica/dbt-expectations/pull/131) [#132](https://github.com/calogica/dbt-expectations/pull/132)) + + +# dbt-expectations v0.5.0 +* adds full support for dbt 1.x without backwards compatability +* supports `dbt-date 0.5.0`, which supports `dbt-utils 0.8.0` + +# dbt-expectations v0.4.7 +* Patch: adds support for dbt 1.x + +# dbt-expectations v0.4.6 + +## What's Changed +* Append missing optional parameters documentation to README.md by @makotonium in https://github.com/calogica/dbt-expectations/pull/124 +* Fix missing group_by default value in string_matching macros by @samantha-guerriero-cko in https://github.com/calogica/dbt-expectations/pull/126 + +## New Contributors +* @makotonium made their first contribution in https://github.com/calogica/dbt-expectations/pull/124 +* @samantha-guerriero-cko made their first contribution in https://github.com/calogica/dbt-expectations/pull/126 +# dbt-expectations v0.4.5 + +## Fixes +* Fix missing group by default value in string_matching macros ([#126](https://github.com/calogica/dbt-expectations/pull/126) by [@samantha-guerriero-cko](https://github.com/samantha-guerriero-cko)) + +## Doc Updates +* Append missing optional parameters documentation to README.md ([#124](https://github.com/calogica/dbt-expectations/pull/124) by [@makotonium](https://github.com/makotonium)) + +# dbt-expectations v0.4.5 + +## Features +* Add an optional argument to allow for intervals of `date_part` in `expect_row_values_to_have_data_for_every_n_datepart`. ([#110](https://github.com/calogica/dbt-expectations/pull/110) by [@lewisarmistead](https://github.com/lewisarmistead)) + +## Fixes + +* Fixed a regression introduced in 0.4.3 that made `expect_table_columns_to_match_ordered_list` incomatible with Redshift ([#123](https://github.com/calogica/dbt-expectations/pull/123) by [@mirosval](https://github.com/mirosval)) + +# dbt-expectations v0.4.4 + +## Fixes + +* Replaced hardcoded value in `expect_column_to_exist` with mapping call to provided transform filter and join to reduce list back to single value. ([#118](https://github.com/calogica/dbt-expectations/pull/118) [@UselessAlias](https://github.com/UselessAlias)) + + +# dbt-expectations v0.4.3 + +## Fixes +* Fixes incompatibility on Snowflake with use of `row_number()` without `order by` in `expect_table_columns_to_match_ordered_list`([#112](https://github.com/calogica/dbt-expectations/pull/112)) + +## Features + +## Under the hood +* Supports dbt 0.21.x + +# dbt-expectations v0.4.2 + +## Features + * Added `row_condition` to `expect_grouped_row_values_to_have_recent_data` and `expect_row_values_to_have_recent_data` to allow for partition filtering before applying the recency test ([#106](https://github.com/calogica/dbt-expectations/pull/106) w/ [@edbizarro](https://github.com/edbizarro)) + +## Under the hood +* Converted Jinja set logic to SQL joins to make it easier to follow and iterate in the future ([#108](https://github.com/calogica/dbt-expectations/pull/108)) + +# dbt-expectations v0.4.1 + +## Fixes +* `expect_table_columns_to_match_list` remove `''` to leave columns as numbers ([#98](https://github.com/calogica/dbt-expectations/issues/98)) + +* `expect_table_columns_to_match_ordered_list` now explicitly casts the column list to a string type ([#99](https://github.com/calogica/dbt-expectations/issues/99)) + +* Fixes regex matching tests for Redshift by adding a Redshift specific adapter macro in `regexp_instr` ([#99](https://github.com/calogica/dbt-expectations/pull/102) @mirosval) + +# dbt-expectations v0.4.0 + +## Breaking Changes + +* Requires `dbt >= 0.20` + +* Requires `dbt-date >= 0.4.0` + +* Updates test macros to tests to support `dbt >= 0.20` + +* Updates calls to adapter.dispatch to support `dbt >= 0.20` (see [Changes to dispatch in dbt v0.20 #78](https://github.com/calogica/dbt-expectations/issues/78)) + +# dbt-expectations v0.3.7 + +* Fix join in `expect_column_values_to_be_in_set` ([#91](https://github.com/calogica/dbt-expectations/pull/91) @ahmedrad) +* Add support for Redshift `random` function in `rand` macro ([#92](https://github.com/calogica/dbt-expectations/pull/92) @ahmedrad) + +# dbt-expectations v0.3.6 + +* Remove unnecessary macro to fix issue with 0.19.2 ([#88](https://github.com/calogica/dbt-expectations/pull/88)) + +# dbt-expectations v0.3.5 + +## Features +* Added a new macro, `expect_row_values_to_have_data_for_every_n_datepart`, which tests whether a model has values for every grouped `date_part`. + + + For example, this tests whether a model has data for every `day` (grouped on `date_col`) from either a specified `start_date` and `end_date`, or for the `min`/`max` value of the specified `date_col`. + + + ```yaml + tests: + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + ``` + +## Fixes + +* Updated description of type check tests ([#84](https://github.com/calogica/dbt-expectations/pull/84) @noel) + +* Fixed `join` syntax because Twitter induced guilt: https://twitter.com/emilyhawkins__/status/1400967270537564160 + +* Bump version of dbt-date to `< 0.4.0` ([#85](https://github.com/calogica/dbt-expectations/issues/85)) + + +# dbt-expectations v0.3.4 + +## Features + +* Added support for optional `min_value` and `max_value` parameters to all`*_between_*` tests. ([#70](https://github.com/calogica/dbt-expectations/pull/70)) + +* Added support for `strictly` parameter to `between` tests. If set to `True`, `striclty` changes the operators `>=` and `<=` to`>` and `<`. + + For example, while + + ```yaml + dbt_expectations.expect_column_stdev_to_be_between: + min_value: 0 + ``` + + evaluates to `>= 0`, + + ```yaml + dbt_expectations.expect_column_stdev_to_be_between: + min_value: 0 + strictly: True + ``` + + evaluates to `> 0`. + ([#72](https://github.com/calogica/dbt-expectations/issues/72), [#74](https://github.com/calogica/dbt-expectations/pull/74)) + +## Fixes + +* Corrected a typo in the README ([#67](https://github.com/calogica/dbt-expectations/pull/67)) + +## Under the hood + +* Refactored `get_select` function to generate SQL grouping more explicitly ([#63](https://github.com/calogica/dbt-expectations/pull/63))) + +* Added dispatch call to `expect_table_row_count_to_equal` to make it easier to shim macros for the tsql-utils package ([#64](https://github.com/calogica/dbt-expectations/pull/64) Thanks [@alieus](https://github.com/alieus)!) diff --git a/dbt_packages/dbt_expectations/LICENSE b/dbt_packages/dbt_expectations/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/dbt_packages/dbt_expectations/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/dbt_packages/dbt_expectations/README.md b/dbt_packages/dbt_expectations/README.md new file mode 100644 index 0000000..1316f1e --- /dev/null +++ b/dbt_packages/dbt_expectations/README.md @@ -0,0 +1,1112 @@ +[![CircleCI](https://circleci.com/gh/calogica/dbt-expectations/tree/main.svg?style=svg)](https://circleci.com/gh/calogica/dbt-expectations/tree/main) + +# dbt-expectations + + + +`dbt-expectations` is an extension package for [**dbt**](https://github.com/dbt-labs/dbt), inspired by the [Great Expectations package for Python](https://greatexpectations.io/). The intent is to allow dbt users to deploy GE-like tests in their data warehouse directly from dbt, vs having to add another integration with their data warehouse. + +## Featured Sponsors ❤️ + +Development of `dbt-expectations` (and `dbt-date`) is funded by our amazing [sponsors](https://github.com/sponsors/calogica), including our featured sponsors: + + + +## Install + +`dbt-expectations` currently supports `dbt 1.0.x`. + +Check [dbt Hub](https://hub.getdbt.com/calogica/dbt_expectations/latest/) for the latest installation instructions, or [read the docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. + +Include in `packages.yml` + +```yaml +packages: + - package: calogica/dbt_expectations + version: [">=0.5.0", "<0.6.0"] + # for the latest version tag +``` + +For latest release, see [https://github.com/calogica/dbt-expectations/releases](https://github.com/calogica/dbt-expectations/releases) + +### Dependencies + +This package includes a reference to [`dbt-date`](https://github.com/calogica/dbt-date) which in turn references [`dbt-utils`](https://github.com/dbt-labs/dbt-utils) so there's no need to also import dbt-utils in your local project. + +Note: we no longer include `spark_utils` in this package to avoid versioning conflicts. If you are running this package on non-core platforms (outside of Snowflake, BigQuery, Redshift, Postgres), you will need to use a package like `spark_utils` to shim macros. + +For example, in `packages.yml`, you will need to include the relevant package: + +```yaml + - package: dbt-labs/spark_utils + version: +``` + +And reference in the dispatch list for `dbt_utils` in `dbt_project.yml`: + +```yaml +vars: + dbt_utils_dispatch_list: [spark_utils] +``` + +### Variables + +The following variables need to be defined in your `dbt_project.yml` file: + +```yaml +vars: + 'dbt_date:time_zone': 'America/Los_Angeles' +``` + +You may specify [any valid timezone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) in place of `America/Los_Angeles`. +For example, use `America/New_York` for East Coast Time. + +## Available Tests + +### Table shape + +- [expect_column_to_exist](#expect_column_to_exist) +- [expect_row_values_to_have_recent_data](#expect_row_values_to_have_recent_data) +- [expect_grouped_row_values_to_have_recent_data](#expect_grouped_row_values_to_have_recent_data) +- [expect_table_column_count_to_be_between](#expect_table_column_count_to_be_between) +- [expect_table_column_count_to_equal_other_table](#expect_table_column_count_to_equal_other_table) +- [expect_table_column_count_to_equal](#expect_table_column_count_to_equal) +- [expect_table_columns_to_not_contain_set](#expect_table_columns_to_not_contain_set) +- [expect_table_columns_to_contain_set](#expect_table_columns_to_contain_set) +- [expect_table_columns_to_match_ordered_list](#expect_table_columns_to_match_ordered_list) +- [expect_table_columns_to_match_set](#expect_table_columns_to_match_set) +- [expect_table_row_count_to_be_between](#expect_table_row_count_to_be_between) +- [expect_table_row_count_to_equal_other_table](#expect_table_row_count_to_equal_other_table) +- [expect_table_row_count_to_equal_other_table_times_factor](#expect_table_row_count_to_equal_other_table_times_factor) +- [expect_table_row_count_to_equal](#expect_table_row_count_to_equal) + +### Missing values, unique values, and types + +- [expect_column_values_to_be_null](#expect_column_values_to_be_null) +- [expect_column_values_to_not_be_null](#expect_column_values_to_not_be_null) +- [expect_column_values_to_be_unique](#expect_column_values_to_be_unique) +- [expect_column_values_to_be_of_type](#expect_column_values_to_be_of_type) +- [expect_column_values_to_be_in_type_list](#expect_column_values_to_be_in_type_list) +- [expect_column_values_to_have_consistent_casing](#expect_column_values_to_have_consistent_casing) + +### Sets and ranges + +- [expect_column_values_to_be_in_set](#expect_column_values_to_be_in_set) +- [expect_column_values_to_not_be_in_set](#expect_column_values_to_not_be_in_set) +- [expect_column_values_to_be_between](#expect_column_values_to_be_between) +- [expect_column_values_to_be_decreasing](#expect_column_values_to_be_decreasing) +- [expect_column_values_to_be_increasing](#expect_column_values_to_be_increasing) + +### String matching + +- [expect_column_value_lengths_to_be_between](#expect_column_value_lengths_to_be_between) +- [expect_column_value_lengths_to_equal](#expect_column_value_lengths_to_equal) +- [expect_column_values_to_match_like_pattern](#expect_column_values_to_match_like_pattern) +- [expect_column_values_to_match_like_pattern_list](#expect_column_values_to_match_like_pattern_list) +- [expect_column_values_to_match_regex](#expect_column_values_to_match_regex) +- [expect_column_values_to_match_regex_list](#expect_column_values_to_match_regex_list) +- [expect_column_values_to_not_match_like_pattern](#expect_column_values_to_not_match_like_pattern) +- [expect_column_values_to_not_match_like_pattern_list](#expect_column_values_to_not_match_like_pattern_list) +- [expect_column_values_to_not_match_regex](#expect_column_values_to_not_match_regex) +- [expect_column_values_to_not_match_regex_list](#expect_column_values_to_not_match_regex_list) + +### Aggregate functions + +- [expect_column_distinct_count_to_be_greater_than](#expect_column_distinct_count_to_be_greater_than) +- [expect_column_distinct_count_to_equal_other_table](#expect_column_distinct_count_to_equal_other_table) +- [expect_column_distinct_count_to_equal](#expect_column_distinct_count_to_equal) +- [expect_column_distinct_values_to_be_in_set](#expect_column_distinct_values_to_be_in_set) +- [expect_column_distinct_values_to_contain_set](#expect_column_distinct_values_to_contain_set) +- [expect_column_distinct_values_to_equal_set](#expect_column_distinct_values_to_equal_set) +- [expect_column_max_to_be_between](#expect_column_max_to_be_between) +- [expect_column_mean_to_be_between](#expect_column_mean_to_be_between) +- [expect_column_median_to_be_between](#expect_column_median_to_be_between) +- [expect_column_min_to_be_between](#expect_column_min_to_be_between) +- [expect_column_most_common_value_to_be_in_set](#expect_column_most_common_value_to_be_in_set) +- [expect_column_proportion_of_unique_values_to_be_between](#expect_column_proportion_of_unique_values_to_be_between) +- [expect_column_quantile_values_to_be_between](#expect_column_quantile_values_to_be_between) +- [expect_column_stdev_to_be_between](#expect_column_stdev_to_be_between) +- [expect_column_sum_to_be_between](#expect_column_sum_to_be_between) +- [expect_column_unique_value_count_to_be_between](#expect_column_unique_value_count_to_be_between) + +### Multi-column + +- [expect_column_pair_values_A_to_be_greater_than_B](#expect_column_pair_values_A_to_be_greater_than_B) +- [expect_column_pair_values_to_be_equal](#expect_column_pair_values_to_be_equal) +- [expect_column_pair_values_to_be_in_set](#expect_column_pair_values_to_be_in_set) +- [expect_compound_columns_to_be_unique](#expect_compound_columns_to_be_unique) +- [expect_multicolumn_sum_to_equal](#expect_multicolumn_sum_to_equal) +- [expect_select_column_values_to_be_unique_within_record](#expect_select_column_values_to_be_unique_within_record) + +### Distributional functions + +- [expect_column_values_to_be_within_n_moving_stdevs](#expect_column_values_to_be_within_n_moving_stdevs) +- [expect_column_values_to_be_within_n_stdevs](#expect_column_values_to_be_within_n_stdevs) +- [expect_row_values_to_have_data_for_every_n_datepart](#expect_row_values_to_have_data_for_every_n_datepart) + +## Documentation + +### [expect_column_to_exist](macros/schema_tests/table_shape/expect_column_to_exist.sql) + +Expect the specified column to exist. + +*Applies to:* Column + +```yaml +tests: +- dbt_expectations.expect_column_to_exist +``` + +### [expect_row_values_to_have_recent_data](macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql) + +Expect the model to have rows that are at least as recent as the defined interval prior to the current timestamp. Optionally gives the possibility to apply filters on the results. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 + row_condition: 'id is not null' #optional +``` + +### [expect_grouped_row_values_to_have_recent_data](macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql) + +Expect the model to have **grouped** rows that are at least as recent as the defined interval prior to the current timestamp. +Use this to test whether there is recent data for each grouped row defined by `group_by` (which is a list of columns) and a `timestamp_column`. Optionally gives the possibility to apply filters on the results. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name : my_model + tests : + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id] + timestamp_column: date_day + datepart: day + interval: 1 + row_condition: "id is not null" #optional + # or also: + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id, other_group_id] + timestamp_column: date_day + datepart: day + interval: 1 + row_condition: "id is not null" #optional +``` + +### [expect_table_column_count_to_be_between](macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql) + +Expect the number of columns in a model to be between two values. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_table_column_count_to_be_between: + min_value: 1 # (Optional) + max_value: 4 # (Optional) +``` + +### [expect_table_column_count_to_equal_other_table](macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql) + +Expect the number of columns in a model to match another model. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_column_count_to_equal_other_table: + compare_model: ref("other_model") +``` + +### [expect_table_columns_to_not_contain_set](macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql) + +Expect the columns in a model not to contain a given list. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_columns_to_not_contain_set: + column_list: ["col_a", "col_b"] + transform: uppper # (Optional) +``` + +### [expect_table_columns_to_contain_set](macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql) + +Expect the columns in a model to contain a given list. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_columns_to_contain_set: + column_list: ["col_a", "col_b"] + transform: uppper # (Optional) +``` + +### [expect_table_column_count_to_equal](macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql) + +Expect the number of columns in a model to be equal to `expected_number_of_columns`. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_column_count_to_equal: + value: 7 +``` + +### [expect_table_columns_to_match_ordered_list](macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql) + +Expect the columns to exactly match a specified list. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_columns_to_match_ordered_list: + column_list: ["col_a", "col_b"] + transform: uppper # (Optional) +``` + +### [expect_table_columns_to_match_set](macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql) + +Expect the columns in a model to match a given list. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_columns_to_match_set: + column_list: ["col_a", "col_b"] + transform: uppper # (Optional) +``` + +### [expect_table_row_count_to_be_between](macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql) + +Expect the number of rows in a model to be between two values. +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_row_count_to_be_between: + min_value: 1 # (Optional) + max_value: 4 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_table_row_count_to_equal_other_table](macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql) + +Expect the number of rows in a model match another model. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_row_count_to_equal_other_table: + compare_model: ref("other_model") + factor: 1 # (Optional) + row_condition: "id is not null" # (Optional) + compare_row_condition: "id is not null" # (Optional) +``` + +### [expect_table_row_count_to_equal_other_table_times_factor](macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql) + +Expect the number of rows in a model to match another model times a preconfigured factor. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_column_count_to_equal_other_table_times_factor: + compare_model: ref("other_model") + factor: 13 + row_condition: "id is not null" # (Optional) + compare_row_condition: "id is not null" # (Optional) +``` + +### [expect_table_row_count_to_equal](macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql) + +Expect the number of rows in a model to be equal to `expected_number_of_rows`. + +*Applies to:* Model, Seed, Source + +```yaml +models: # or seeds: + - name: my_model + tests: + - dbt_expectations.expect_table_row_count_to_equal: + value: 4 + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_unique](macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql) + +Expect each column value to be unique. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_unique: + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_not_be_null](macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql) + +Expect column values to not be null. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_be_null: + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_null](macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql) + +Expect column values to be null. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_null: + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_of_type](macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql) + +Expect a column to be of a specified data type. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_of_type: + column_type: date +``` + +### [expect_column_values_to_be_in_type_list](macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql) + +Expect a column to be one of a specified type list. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: [date, datetime] +``` + +### [expect_column_values_to_have_consistent_casing](macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql) + +Expect a column to have consistent casing. By setting `display_inconsistent_columns` to true, the number of inconsistent values in the column will be displayed in the terminal whereas the inconsistent values themselves will be returned if the SQL compiled test is run. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_have_consistent_casing: + display_inconsistent_columns: false # (Optional) +``` + +### [expect_column_values_to_be_in_set](macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql) + +Expect each column value to be in a given set. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['a','b','c'] + quote_values: true # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_between](macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql) + +Expect each column value to be between two values. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 # (Optional) + max_value: 10 # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_values_to_not_be_in_set](macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql) + +Expect each column value not to be in a given set. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_be_in_set: + value_set: ['e','f','g'] + quote_values: true # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_increasing](macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql) + +Expect column values to be increasing. + +If `strictly: True`, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_increasing: + sort_column: date_day + row_condition: "id is not null" # (Optional) + strictly: true # (Optional for comparison operator. Default is 'true', and it uses '>'. If set to 'false' it uses '>='.) + group_by: [group_id, other_group_id, ...] # (Optional) +``` + +### [expect_column_values_to_be_decreasing](macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql) + +Expect column values to be decreasing. + +If `strictly=True`, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_decreasing: + sort_column: col_numeric_a + row_condition: "id is not null" # (Optional) + strictly: true # (Optional for comparison operator. Default is 'true' and it uses '<'. If set to 'false', it uses '<='.) + group_by: [group_id, other_group_id, ...] # (Optional) +``` + +### [expect_column_value_lengths_to_be_between](macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql) + +Expect column entries to be strings with length between a min_value value and a max_value value (inclusive). + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_value_lengths_to_be_between: + min_value: 1 # (Optional) + max_value: 4 # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_value_lengths_to_equal](macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql) + +Expect column entries to be strings with length equal to the provided value. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_value_lengths_to_equal: + value: 10 + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_match_regex](macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql) + +Expect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example "[at]+" will identify the following strings as expected: "cat", "hat", "aa", "a", and "t", and the following strings as unexpected: "fish", "dog". + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_match_regex: + regex: "[at]+" + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_not_match_regex](macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql) + +Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, "[at]+" would identify the following strings as expected: "fish”, "dog”, and the following as unexpected: "cat”, "hat”. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_match_regex: + regex: "[at]+" + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_match_regex_list](macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql) + +Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_match_regex_list: + regex_list: ["@[^.]*", "&[^.]*"] + match_on: any # (Optional. Default is 'any', which applies an 'OR' for each regex. If 'all', it applies an 'AND' for each regex.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_not_match_regex_list](macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql) + +Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_match_regex_list: + regex_list: ["@[^.]*", "&[^.]*"] + match_on: any # (Optional. Default is 'any', which applies an 'OR' for each regex. If 'all', it applies an 'AND' for each regex.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_match_like_pattern](macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql) + +Expect column entries to be strings that match a given SQL `like` pattern. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_match_like_pattern: + like_pattern: "%@%" + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_not_match_like_pattern](macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql) + +Expect column entries to be strings that do not match a given SQL `like` pattern. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_match_like_pattern: + like_pattern: "%&%" + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_match_like_pattern_list](macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql) + +Expect the column entries to be strings that match any of a list of SQL `like` patterns. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_match_like_pattern_list: + like_pattern_list: ["%@%", "%&%"] + match_on: any # (Optional. Default is 'any', which applies an 'OR' for each pattern. If 'all', it applies an 'AND' for each regex.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_not_match_like_pattern_list](macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql) + +Expect the column entries to be strings that do not match any of a list of SQL `like` patterns. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_not_match_like_pattern_list: + like_pattern_list: ["%@%", "%&%"] + match_on: any # (Optional. Default is 'any', which applies an 'OR' for each pattern. If 'all', it applies an 'AND' for each regex.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_count_to_equal](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql) + +Expect the number of distinct column values to be equal to a given value. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_distinct_count_to_equal: + value: 10 + quote_values: false # (Optional. Default is 'false'.) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_count_to_be_greater_than](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql) + +Expect the number of distinct column values to be greater than a given value. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_distinct_count_to_be_greater_than: + value: 10 + quote_values: false # (Optional. Default is 'false'.) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_values_to_be_in_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql) + +Expect the set of distinct column values to be contained by a given set. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_distinct_values_to_be_in_set: + value_set: ['a','b','c','d'] + quote_values: false # (Optional. Default is 'false'.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_values_to_contain_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql) + +Expect the set of distinct column values to contain a given set. + +In contrast to `expect_column_values_to_be_in_set` this ensures not that all column values are members of the given set but that values from the set must be present in the column. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_distinct_values_to_contain_set: + value_set: ['a','b'] + quote_values: false # (Optional. Default is 'false'.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_values_to_equal_set](macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql) + +Expect the set of distinct column values to equal a given set. + +In contrast to `expect_column_distinct_values_to_contain_set` this ensures not only that a certain set of values are present in the column but that these and only these values are present. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_distinct_values_to_equal_set: + value_set: ['a','b','c'] + quote_values: true # (Optional. Default is 'true'.) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_distinct_count_to_equal_other_table](macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql) + +Expect the number of distinct column values to be equal to number of distinct values in another model. + +*Applies to:* Model, Column, Seed, Source + +This can be applied to a model: + +```yaml +models: # or seeds: + - name: my_model_1 + tests: + - dbt_expectations.expect_column_distinct_count_to_equal_other_table: + column_name: col_1 + compare_model: ref("my_model_2") + compare_column_name: col_2 + row_condition: "id is not null" # (Optional) + compare_row_condition: "id is not null" # (Optional) +``` + +or at the column level: + +```yaml +models: # or seeds: + - name: my_model_1 + columns: + - name: col_1 + tests: + - dbt_expectations.expect_column_distinct_count_to_equal_other_table: + compare_model: ref("my_model_2") + compare_column_name: col_2 + row_condition: "id is not null" # (Optional) + compare_row_condition: "id is not null" # (Optional) +``` + +If `compare_model` or `compare_column_name` are no specified, `model` and `column_name` are substituted. So, one could compare distinct counts of two different columns in the same model, or identically named columns in separate models etc. + +### [expect_column_mean_to_be_between](macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql) + +Expect the column mean to be between a min_value value and a max_value value (inclusive). + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_mean_to_be_between: + min_value: 0 # (Optional) + max_value: 2 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_median_to_be_between](macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql) + +Expect the column median to be between a min_value value and a max_value value (inclusive). + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_median_to_be_between: + min_value: 0 + max_value: 2 + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_quantile_values_to_be_between](macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql) + +Expect specific provided column quantiles to be between provided min_value and max_value values. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_quantile_values_to_be_between: + quantile: .95 + min_value: 0 # (Optional) + max_value: 2 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_stdev_to_be_between](macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql) + +Expect the column standard deviation to be between a min_value value and a max_value value. Uses sample standard deviation (normalized by N-1). + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_stdev_to_be_between: + min_value: 0 # (Optional) + max_value: 2 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_unique_value_count_to_be_between](macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql) + +Expect the number of unique values to be between a min_value value and a max_value value. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_unique_value_count_to_be_between: + min_value: 3 # (Optional) + max_value: 3 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_proportion_of_unique_values_to_be_between](macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql) + +Expect the proportion of unique values to be between a min_value value and a max_value value. + +For example, in a column containing [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], there are 4 unique values and 10 total values for a proportion of 0.4. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_proportion_of_unique_values_to_be_between: + min_value: 0 # (Optional) + max_value: .4 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_most_common_value_to_be_in_set](macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql) + +Expect the most common value to be within the designated value set + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_most_common_value_to_be_in_set: + value_set: [0.5] + top_n: 1 + quote_values: false # (Optional) + data_type: "decimal" # (Optional. Default is 'decimal') + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_max_to_be_between](macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql) + +Expect the column max to be between a min and max value + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_max_to_be_between: + min_value: 1 # (Optional) + max_value: 1 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_min_to_be_between](macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql) + +Expect the column min to be between a min and max value + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_min_to_be_between: + min_value: 0 # (Optional) + max_value: 1 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_sum_to_be_between](macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql) + +Expect the column to sum to be between a min and max value + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_sum_to_be_between: + min_value: 1 # (Optional) + max_value: 2 # (Optional) + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) + strictly: false # (Optional. Default is 'false'. Adds an 'or equal to' to the comparison operator for min/max) +``` + +### [expect_column_pair_values_A_to_be_greater_than_B](macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql) + +Expect values in column A to be greater than column B. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: col_numeric_a + column_B: col_numeric_a + or_equal: True + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_pair_values_to_be_equal](macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql) + +Expect the values in column A to be the same as column B. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_column_pair_values_to_be_equal: + column_A: col_numeric_a + column_B: col_numeric_a + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_pair_values_to_be_in_set](macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql) + +Expect paired values from columns A and B to belong to a set of valid pairs. + +Note: value pairs are expressed as lists within lists + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_column_pair_values_to_be_in_set: + column_A: col_numeric_a + column_B: col_numeric_b + value_pairs_set: [[0, 1], [1, 0], [0.5, 0.5], [0.5, 0.5]] + row_condition: "id is not null" # (Optional) +``` + +### [expect_select_column_values_to_be_unique_within_record](macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql) + +Expect the values for each record to be unique across the columns listed. Note that records can be duplicated. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_select_column_values_to_be_unique_within_record: + column_list: ["col_string_a", "col_string_b"] + ignore_row_if: "any_value_is_missing" # (Optional. Default is 'all_values_are_missing') + quote_columns: false # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_multicolumn_sum_to_equal](macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql) + +Expects that sum of all rows for a set of columns is equal to a specific value + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_multicolumn_sum_to_equal: + column_list: ["col_numeric_a", "col_numeric_b"] + sum_total: 4 + group_by: [group_id, other_group_id, ...] # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_compound_columns_to_be_unique](macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql) + +Expect that the columns are unique together, e.g. a multi-column primary key. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_compound_columns_to_be_unique: + column_list: ["date_col", "col_string_b"] + ignore_row_if: "any_value_is_missing" # (Optional. Default is 'all_values_are_missing') + quote_columns: false # (Optional) + row_condition: "id is not null" # (Optional) +``` + +### [expect_column_values_to_be_within_n_moving_stdevs](macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql) + +Expects changes in metric values to be within Z sigma away from a moving average, taking the (optionally logged) differences of an aggregated metric value and comparing it to its value N days ago. + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs: + date_column_name: date + period: day # (Optional. Default is 'day') + lookback_periods: 1 # (Optional. Default is 1) + trend_periods: 7 # (Optional. Default is 7) + test_periods: 14 # (Optional. Default is 14) + sigma_threshold: 3 # (Optional. Default is 3) + take_logs: true # (Optional. Default is 'true') + sigma_threshold_upper: x # (Optional. Replace 'x' with a value. Default is 'None') + sigma_threshold_lower: y # (Optional. Replace 'y' with a value. Default is 'None') + take_diffs: true # (Optional) +``` + +### [expect_column_values_to_be_within_n_stdevs](macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql) + +Expects (optionally grouped & summed) metric values to be within Z sigma away from the column average + +*Applies to:* Column + +```yaml +tests: + - dbt_expectations.expect_column_values_to_be_within_n_stdevs: + group_by: date_day # (Optional. Default is 'None') + sigma_threshold: 3 # (Optional. Default is 3) +``` + +### [expect_row_values_to_have_data_for_every_n_datepart](macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql) + +Expects model to have values for every grouped `date_part`. + +For example, this tests whether a model has data for every `day` (grouped on `date_col`) between either: + +- The `min`/`max` value of the specified `date_col` (default). +- A specified `test_start_date` and/or `test_end_date`. + +*Applies to:* Model, Seed, Source + +```yaml +tests: + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day # (Optional. Default is 'day') + row_condition: "id is not null" # (Optional) + test_start_date: 'yyyy-mm-dd' # (Optional. Replace 'yyyy-mm-dd' with a date. Default is 'None') + test_end_date: 'yyyy-mm-dd' # (Optional. Replace 'yyyy-mm-dd' with a date. Default is 'None') + exclusion_condition: statement # (Optional. See details below. Default is 'None') +``` + +**Notes**: + +- `test_end_date` is exclusive, e.g. a test with `test_end_date` value of `'2020-01-05'` will pass if your model has data through `'2021-01-04'`. + +- If `test_start_date` or `test_end_date` are not specified, the test automatically determines the `min`/`max` of the specified `date_col` from your data, respectively. +On some platforms, and/or if your table is not partitione on that date column, this may lead to performance issues. In these cases, we recommend setting an explicit date literal. You may also set a "dynamic" date literal via the built-in `modules.datetime` functions: + +```yaml + date_part: day + test_start_date: '2021-05-01' + test_end_date: '{{ modules.datetime.date.today() }}' +``` + +or, for example: + +```yaml + date_part: day + test_start_date: '2021-05-01' + test_end_date: '{{ modules.datetime.date.today() - modules.datetime.timedelta(1)) }}' +``` + +Unfortunately, you currently **cannot** use a dynamic SQL date, such as `current_date` or macro from a dbt package such as dbt-date, as the underlying `dbt_utils.date_spine` expects a date literal. + +The `interval` argument will optionally group `date_part` by a given integer to test data presence at a lower granularity, e.g. adding `interval: 7` to the example above will test whether a model has data for each 7-`day` period instead of for each `day`. + +Known or expected missing dates can be excluded from the test by setting the `exclusion_criteria` with a valid SQL statement; e.g., adding `exclusion_condition: not(date_day = '2021-10-19')` will ensure that test passes if and only if `date_day = '2021-10-19'` is the only date with missing data. Alternatively, `exclusion_condition: not(date_part(month, date_day) = 12 and date_part(day, date_day) = 25)` will permit data to be missing on the 25th of December (Christmas day) every year. + +## ~ Developers Only ~ + +### Integration Tests + +This project contains integration tests for all test macros in a separate `integration_tests` dbt project contained in this repo. + +To run the tests: + +1. You will need a profile called `integration_tests` in `~/.dbt/profiles.yml` pointing to a writable database. We only support postgres, BigQuery and Snowflake. +2. Then, from within the `integration_tests` folder, run `dbt build` to run the test models in `integration_tests/models/schema_tests/` and run the tests specified in `integration_tests/models/schema_tests/schema.yml` diff --git a/dbt_packages/dbt_expectations/data/.gitkeep b/dbt_packages/dbt_expectations/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_expectations/dbt_project.yml b/dbt_packages/dbt_expectations/dbt_project.yml new file mode 100644 index 0000000..115d8b8 --- /dev/null +++ b/dbt_packages/dbt_expectations/dbt_project.yml @@ -0,0 +1,18 @@ + +# Name your project! Project names should contain only lowercase characters +# and underscores. A good package name should reflect your organization's +# name or the intended use of these models +name: 'dbt_expectations' +version: '0.5.0' + +require-dbt-version: [">=1.0.0", "<2.0.0"] +config-version: 2 + +target-path: "target" +clean-targets: ["target", "dbt_packages"] +macro-paths: ["macros"] +log-path: "logs" + +dispatch: + - macro_namespace: dbt_utils + search_order: ['dbt_expectations', 'dbt_utils'] # enable override diff --git a/dbt_packages/dbt_expectations/docs/catalog.json b/dbt_packages/dbt_expectations/docs/catalog.json new file mode 100644 index 0000000..b38957f --- /dev/null +++ b/dbt_packages/dbt_expectations/docs/catalog.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.4", "generated_at": "2022-04-04T13:59:53.972004Z", "invocation_id": "cd337e8c-7562-4ea1-a984-9fb3a454bc80", "env": {}}, "nodes": {"model.dbt_expectations_integration_tests.data_test": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "data_test", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"idx": {"type": "integer", "index": 1, "name": "idx", "comment": null}, "date_col": {"type": "text", "index": 2, "name": "date_col", "comment": null}, "col_numeric_a": {"type": "double precision", "index": 3, "name": "col_numeric_a", "comment": null}, "col_numeric_b": {"type": "double precision", "index": 4, "name": "col_numeric_b", "comment": null}, "col_string_a": {"type": "text", "index": 5, "name": "col_string_a", "comment": null}, "col_string_b": {"type": "text", "index": 6, "name": "col_string_b", "comment": null}, "col_null": {"type": "character varying", "index": 7, "name": "col_null", "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.dbt_expectations_integration_tests.data_test"}, "model.dbt_expectations_integration_tests.data_test_factored": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "data_test_factored", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"generated_number": {"type": "double precision", "index": 1, "name": "generated_number", "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.dbt_expectations_integration_tests.data_test_factored"}, "model.dbt_expectations_integration_tests.emails": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "emails", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"email_address": {"type": "text", "index": 1, "name": "email_address", "comment": null}, "reg_exp": {"type": "text", "index": 2, "name": "reg_exp", "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.dbt_expectations_integration_tests.emails"}, "model.dbt_expectations_integration_tests.series_10": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "series_10", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"generated_number": {"type": "double precision", "index": 1, "name": "generated_number", "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.dbt_expectations_integration_tests.series_10"}, "model.dbt_expectations_integration_tests.series_4": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "series_4", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"generated_number": {"type": "double precision", "index": 1, "name": "generated_number", "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.dbt_expectations_integration_tests.series_4"}, "model.dbt_expectations_integration_tests.timeseries_base": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_base", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_day": {"type": "timestamp without time zone", "index": 1, "name": "date_day", "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.dbt_expectations_integration_tests.timeseries_base"}, "model.dbt_expectations_integration_tests.timeseries_data": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_data", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_day": {"type": "timestamp without time zone", "index": 1, "name": "date_day", "comment": null}, "date_datetime": {"type": "timestamp without time zone", "index": 2, "name": "date_datetime", "comment": null}, "date_timestamp": {"type": "timestamp without time zone", "index": 3, "name": "date_timestamp", "comment": null}, "row_value": {"type": "double precision", "index": 4, "name": "row_value", "comment": null}, "row_value_log": {"type": "double precision", "index": 5, "name": "row_value_log", "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.dbt_expectations_integration_tests.timeseries_data"}, "model.dbt_expectations_integration_tests.timeseries_data_extended": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_data_extended", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_day": {"type": "timestamp without time zone", "index": 1, "name": "date_day", "comment": null}, "row_value": {"type": "double precision", "index": 2, "name": "row_value", "comment": null}, "row_value_log": {"type": "double precision", "index": 3, "name": "row_value_log", "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.dbt_expectations_integration_tests.timeseries_data_extended"}, "model.dbt_expectations_integration_tests.timeseries_data_grouped": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_data_grouped", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_day": {"type": "timestamp without time zone", "index": 1, "name": "date_day", "comment": null}, "group_id": {"type": "integer", "index": 2, "name": "group_id", "comment": null}, "row_value": {"type": "integer", "index": 3, "name": "row_value", "comment": null}, "row_value_log": {"type": "double precision", "index": 4, "name": "row_value_log", "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.dbt_expectations_integration_tests.timeseries_data_grouped"}, "model.dbt_expectations_integration_tests.timeseries_hourly": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_hourly", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_hour": {"type": "timestamp without time zone", "index": 1, "name": "date_hour", "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.dbt_expectations_integration_tests.timeseries_hourly"}, "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "timeseries_hourly_data_extended", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"date_hour": {"type": "timestamp without time zone", "index": 1, "name": "date_hour", "comment": null}, "row_value": {"type": "double precision", "index": 2, "name": "row_value", "comment": null}, "row_value_log": {"type": "double precision", "index": 3, "name": "row_value_log", "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.dbt_expectations_integration_tests.timeseries_hourly_data_extended"}, "model.dbt_expectations_integration_tests.window_function_test": {"metadata": {"type": "BASE TABLE", "schema": "dbt_expectations_integration_tests", "name": "window_function_test", "database": "postgres", "comment": null, "owner": "postgres"}, "columns": {"idx": {"type": "integer", "index": 1, "name": "idx", "comment": null}, "date_col": {"type": "text", "index": 2, "name": "date_col", "comment": null}, "col_numeric_a": {"type": "double precision", "index": 3, "name": "col_numeric_a", "comment": null}, "rolling_sum_increasing": {"type": "double precision", "index": 4, "name": "rolling_sum_increasing", "comment": null}, "rolling_sum_decreasing": {"type": "double precision", "index": 5, "name": "rolling_sum_decreasing", "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.dbt_expectations_integration_tests.window_function_test"}}, "sources": {}, "errors": null} \ No newline at end of file diff --git a/dbt_packages/dbt_expectations/docs/index.html b/dbt_packages/dbt_expectations/docs/index.html new file mode 100644 index 0000000..0c4d0ec --- /dev/null +++ b/dbt_packages/dbt_expectations/docs/index.html @@ -0,0 +1,102 @@ + + + + + + + dbt Docs + + + + + + + + + + + + + + + + + +
icons
+
+ + diff --git a/dbt_packages/dbt_expectations/docs/manifest.json b/dbt_packages/dbt_expectations/docs/manifest.json new file mode 100644 index 0000000..c8a7f42 --- /dev/null +++ b/dbt_packages/dbt_expectations/docs/manifest.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.4", "generated_at": "2022-04-04T13:59:49.488285Z", "invocation_id": "cd337e8c-7562-4ea1-a984-9fb3a454bc80", "env": {}, "project_id": "d9b3c2176db98e2e717cbb6a2ee41ffd", "user_id": null, "send_anonymous_usage_stats": false, "adapter_type": "postgres"}, "nodes": {"model.dbt_expectations_integration_tests.data_test": {"raw_sql": "select\n 1 as idx,\n '2020-10-21' as date_col,\n cast(0 as {{ dbt_utils.type_float() }}) as col_numeric_a,\n cast(1 as {{ dbt_utils.type_float() }}) as col_numeric_b,\n 'a' as col_string_a,\n 'b' as col_string_b,\n cast(null as {{ dbt_utils.type_string() }}) as col_null\n\nunion all\n\nselect\n 2 as idx,\n '2020-10-22' as date_col,\n 1 as col_numeric_a,\n 0 as col_numeric_b,\n 'b' as col_string_a,\n 'ab' as col_string_b,\n null as col_null\n\nunion all\n\nselect\n 3 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a,\n 0.5 as col_numeric_b,\n 'c' as col_string_a,\n 'abc' as col_string_b,\n null as col_null\n\nunion all\n\nselect\n 4 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a,\n 0.5 as col_numeric_b,\n 'c' as col_string_a,\n 'abcd' as col_string_b,\n null as col_null", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_float", "macro.dbt_utils.type_string"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "data_test"], "unique_id": "model.dbt_expectations_integration_tests.data_test", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/data_test.sql", "original_file_path": "models/schema_tests/data_test.sql", "name": "data_test", "alias": "data_test", "checksum": {"name": "sha256", "checksum": "b508c1bdbb742d4379f28557c7e8bbd5f95b751c8a654a1b12b91ce2436923ba"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {"idx": {"name": "idx", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "col_numeric_a": {"name": "col_numeric_a", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "col_string_a": {"name": "col_string_a", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "col_string_b": {"name": "col_string_b", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "col_null": {"name": "col_null", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/data_test.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.148748, "compiled_sql": "select\n 1 as idx,\n '2020-10-21' as date_col,\n cast(0 as \n float\n) as col_numeric_a,\n cast(1 as \n float\n) as col_numeric_b,\n 'a' as col_string_a,\n 'b' as col_string_b,\n cast(null as \n varchar\n) as col_null\n\nunion all\n\nselect\n 2 as idx,\n '2020-10-22' as date_col,\n 1 as col_numeric_a,\n 0 as col_numeric_b,\n 'b' as col_string_a,\n 'ab' as col_string_b,\n null as col_null\n\nunion all\n\nselect\n 3 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a,\n 0.5 as col_numeric_b,\n 'c' as col_string_a,\n 'abc' as col_string_b,\n null as col_null\n\nunion all\n\nselect\n 4 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a,\n 0.5 as col_numeric_b,\n 'c' as col_string_a,\n 'abcd' as col_string_b,\n null as col_null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.data_test"}, "model.dbt_expectations_integration_tests.series_4": {"raw_sql": "{{ dbt_utils.generate_series(upper_bound=4) }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.generate_series"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "series_4"], "unique_id": "model.dbt_expectations_integration_tests.series_4", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/series_4.sql", "original_file_path": "models/schema_tests/series_4.sql", "name": "series_4", "alias": "series_4", "checksum": {"name": "sha256", "checksum": "3c3640a2418d29caf1b1ea4a806cdd7f303b34714217c17d1b113f10f0f20d82"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/series_4.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080790.94089, "compiled_sql": "\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 + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 4\n order by generated_number\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.series_4"}, "model.dbt_expectations_integration_tests.timeseries_data_grouped": {"raw_sql": "with dates as (\n select * from {{ ref('timeseries_base') }}\n),\ngroupings as (\n select * from {{ ref('series_4') }}\n),\nrow_values as (\n select * from {{ ref('series_10') }}\n),\nadd_row_values as (\n\n select\n cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_day,\n cast(g.generated_number as {{ dbt_utils.type_int() }}) as group_id,\n cast(floor(100 * r.generated_number) as {{ dbt_utils.type_int() }}) as row_value\n from\n dates d\n cross join\n groupings g\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_expectations.type_datetime", "macro.dbt_utils.type_int", "macro.dbt_expectations.log_natural"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_base", "model.dbt_expectations_integration_tests.series_4", "model.dbt_expectations_integration_tests.series_10"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_data_grouped"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_data_grouped", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_data_grouped.sql", "original_file_path": "models/schema_tests/timeseries_data_grouped.sql", "name": "timeseries_data_grouped", "alias": "timeseries_data_grouped", "checksum": {"name": "sha256", "checksum": "66f2b103bb5fffb976116f0991e2ced1999fb8fe2c73934075f847ec985ceb38"}, "tags": [], "refs": [["timeseries_base"], ["series_4"], ["series_10"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_data_grouped.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.149992, "compiled_sql": "with dates as (\n select * from postgres.dbt_expectations_integration_tests.timeseries_base\n),\ngroupings as (\n select * from postgres.dbt_expectations_integration_tests.series_4\n),\nrow_values as (\n select * from postgres.dbt_expectations_integration_tests.series_10\n),\nadd_row_values as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n cast(g.generated_number as \n int\n) as group_id,\n cast(floor(100 * r.generated_number) as \n int\n) as row_value\n from\n dates d\n cross join\n groupings g\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n \n\n ln(nullif(row_value, 0))\n as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_data_grouped"}, "model.dbt_expectations_integration_tests.timeseries_hourly": {"raw_sql": "{{ dbt_utils.date_spine('hour',\n start_date=dbt_date.n_days_ago(10),\n end_date=dbt_date.tomorrow()\n ) }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_date.n_days_ago", "macro.dbt_date.tomorrow", "macro.dbt_utils.date_spine"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_hourly"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_hourly", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_hourly.sql", "original_file_path": "models/schema_tests/timeseries_hourly.sql", "name": "timeseries_hourly", "alias": "timeseries_hourly", "checksum": {"name": "sha256", "checksum": "e6ca8e21fdea8b2541070d3c552d9303720dd16eae98ddbe1eb9098293ee89ff"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.001533, "compiled_sql": "\n\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 + 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 <= 264.0\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast(\n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (-10))\n\n as date) + ((interval '1 hour') * (row_number() over (order by 1) - 1))\n\n\n ) as date_hour\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_hour <= cast(\n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (1))\n\n as date)\n\n)\n\nselect * from filtered\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_hourly"}, "model.dbt_expectations_integration_tests.timeseries_base": {"raw_sql": "{{ dbt_date.get_base_dates(n_dateparts=366, datepart='day') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_date.get_base_dates"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_base"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_base", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_base.sql", "original_file_path": "models/schema_tests/timeseries_base.sql", "name": "timeseries_base", "alias": "timeseries_base", "checksum": {"name": "sha256", "checksum": "30c069ae8cdf9621fcf3604fccba528dd9f7dc34de11a173c08d0534327a9033"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_base.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.045013, "compiled_sql": "\n with date_spine as\n(\n\n \n\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 + 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 <= 367\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n \n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (-366))\n\n + ((interval '1 day') * (row_number() over (order by 1) - 1))\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 <= cast(\n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (1))\n\n as date)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_day as timestamp without time zone) as date_day\nfrom\n date_spine d\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_base"}, "model.dbt_expectations_integration_tests.timeseries_data": {"raw_sql": "with dates as (\n\n select * from {{ ref('timeseries_base') }}\n\n),\nadd_row_values as (\n\n select\n d.date_day,\n cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_datetime,\n cast(d.date_day as {{ dbt_utils.type_timestamp() }}) as date_timestamp,\n cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value\n from\n dates d\n\n),\nadd_logs as (\n\n select\n *,\n {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_expectations.type_datetime", "macro.dbt_utils.type_timestamp", "macro.dbt_expectations.rand", "macro.dbt_utils.type_float", "macro.dbt_expectations.log_natural"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_base"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_data"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_data", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_data.sql", "original_file_path": "models/schema_tests/timeseries_data.sql", "name": "timeseries_data", "alias": "timeseries_data", "checksum": {"name": "sha256", "checksum": "c8aaade65fc97cdc59feca058721b850c5870395ff2db74046ef6974a52ba8bd"}, "tags": [], "refs": [["timeseries_base"]], "sources": [], "description": "", "columns": {"date_day": {"name": "date_day", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date_datetime": {"name": "date_datetime", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date_timestamp": {"name": "date_timestamp", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "row_value": {"name": "row_value", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_data.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.140629, "compiled_sql": "with dates as (\n\n select * from postgres.dbt_expectations_integration_tests.timeseries_base\n\n),\nadd_row_values as (\n\n select\n d.date_day,\n cast(d.date_day as timestamp without time zone) as date_datetime,\n cast(d.date_day as timestamp without time zone) as date_timestamp,\n cast(abs(\n\n random()\n) as \n float\n) as row_value\n from\n dates d\n\n),\nadd_logs as (\n\n select\n *,\n \n\n ln(nullif(row_value, 0))\n as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_data"}, "model.dbt_expectations_integration_tests.window_function_test": {"raw_sql": "with data_example as (\n\n select\n 1 as idx,\n '2020-10-21' as date_col,\n cast(0 as {{ dbt_utils.type_float() }}) as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-22' as date_col,\n 1 as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-23' as date_col,\n 2 as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-24' as date_col,\n 1 as col_numeric_a\n\n union all\n\n select\n 3 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a\n union all\n\n select\n 4 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a\n\n)\nselect\n *,\n sum(col_numeric_a) over (partition by idx order by date_col) as rolling_sum_increasing,\n sum(col_numeric_a) over (partition by idx order by date_col desc) as rolling_sum_decreasing\nfrom\n data_example", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_float"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "window_function_test"], "unique_id": "model.dbt_expectations_integration_tests.window_function_test", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/window_function_test.sql", "original_file_path": "models/schema_tests/window_function_test.sql", "name": "window_function_test", "alias": "window_function_test", "checksum": {"name": "sha256", "checksum": "7ba1441e289b93df3aaf6167a22bff4dd703098a7fc6f34fd9568bef79ec7686"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {"rolling_sum_increasing": {"name": "rolling_sum_increasing", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rolling_sum_decreasing": {"name": "rolling_sum_decreasing", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/window_function_test.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.151233, "compiled_sql": "with data_example as (\n\n select\n 1 as idx,\n '2020-10-21' as date_col,\n cast(0 as \n float\n) as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-22' as date_col,\n 1 as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-23' as date_col,\n 2 as col_numeric_a\n\n union all\n\n select\n 2 as idx,\n '2020-10-24' as date_col,\n 1 as col_numeric_a\n\n union all\n\n select\n 3 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a\n union all\n\n select\n 4 as idx,\n '2020-10-23' as date_col,\n 0.5 as col_numeric_a\n\n)\nselect\n *,\n sum(col_numeric_a) over (partition by idx order by date_col) as rolling_sum_increasing,\n sum(col_numeric_a) over (partition by idx order by date_col desc) as rolling_sum_decreasing\nfrom\n data_example", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.window_function_test"}, "model.dbt_expectations_integration_tests.emails": {"raw_sql": "select\n 'ab@gmail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'ab@mail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'abc@gmail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'abc.com@gmail.com' as email_address,\n '@[^.]*' as reg_exp", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "emails"], "unique_id": "model.dbt_expectations_integration_tests.emails", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/emails.sql", "original_file_path": "models/schema_tests/emails.sql", "name": "emails", "alias": "emails", "checksum": {"name": "sha256", "checksum": "0a7dcbbd9aec1f2556b17ac14aa18f97088f4edf4ffff9bcc03d8533ff78452e"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {"email_address": {"name": "email_address", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/emails.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.1383522, "compiled_sql": "select\n 'ab@gmail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'ab@mail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'abc@gmail.com' as email_address,\n '@[^.]*' as reg_exp\n\nunion all\n\nselect\n 'abc.com@gmail.com' as email_address,\n '@[^.]*' as reg_exp", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.emails"}, "model.dbt_expectations_integration_tests.series_10": {"raw_sql": "{{ dbt_utils.generate_series(upper_bound=10) }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.generate_series"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "series_10"], "unique_id": "model.dbt_expectations_integration_tests.series_10", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/series_10.sql", "original_file_path": "models/schema_tests/series_10.sql", "name": "series_10", "alias": "series_10", "checksum": {"name": "sha256", "checksum": "e8a34eaf70a78746b59bd12f97c1c88275c86be036a28f9afa42a53f8a049c1b"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/series_10.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.0757592, "compiled_sql": "\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 + 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 \n \n\n )\n\n select *\n from unioned\n where generated_number <= 10\n order by generated_number\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.series_10"}, "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended": {"raw_sql": "with dates as (\n\n select * from {{ ref('timeseries_hourly') }}\n\n),\nrow_values as (\n select * from {{ ref('series_10') }}\n),\nadd_row_values as (\n\n select\n cast(d.date_hour as {{ dbt_expectations.type_datetime() }}) as date_hour,\n cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value\n from\n dates d\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_expectations.type_datetime", "macro.dbt_expectations.rand", "macro.dbt_utils.type_float", "macro.dbt_expectations.log_natural"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly", "model.dbt_expectations_integration_tests.series_10"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_hourly_data_extended"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_hourly_data_extended.sql", "original_file_path": "models/schema_tests/timeseries_hourly_data_extended.sql", "name": "timeseries_hourly_data_extended", "alias": "timeseries_hourly_data_extended", "checksum": {"name": "sha256", "checksum": "9c60780c00cd700702c1bfd19b6345c4cb89820be505450186fae0620031b2bd"}, "tags": [], "refs": [["timeseries_hourly"], ["series_10"]], "sources": [], "description": "", "columns": {"date_hour": {"name": "date_hour", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "row_value_log": {"name": "row_value_log", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_hourly_data_extended.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.14466, "compiled_sql": "with dates as (\n\n select * from postgres.dbt_expectations_integration_tests.timeseries_hourly\n\n),\nrow_values as (\n select * from postgres.dbt_expectations_integration_tests.series_10\n),\nadd_row_values as (\n\n select\n cast(d.date_hour as timestamp without time zone) as date_hour,\n cast(abs(\n\n random()\n) as \n float\n) as row_value\n from\n dates d\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n \n\n ln(nullif(row_value, 0))\n as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_hourly_data_extended"}, "model.dbt_expectations_integration_tests.data_test_factored": {"raw_sql": "{{ dbt_utils.generate_series(upper_bound=8) }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.generate_series"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "data_test_factored"], "unique_id": "model.dbt_expectations_integration_tests.data_test_factored", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/data_test_factored.sql", "original_file_path": "models/schema_tests/data_test_factored.sql", "name": "data_test_factored", "alias": "data_test_factored", "checksum": {"name": "sha256", "checksum": "788e71c6fbed11e01fd2ea9d3c5cb473542cefdbf45a801424bf93e692b8b1f0"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/data_test_factored.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.149363, "compiled_sql": "\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 + 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 \n \n\n )\n\n select *\n from unioned\n where generated_number <= 8\n order by generated_number\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.data_test_factored"}, "model.dbt_expectations_integration_tests.timeseries_data_extended": {"raw_sql": "with dates as (\n\n select * from {{ ref('timeseries_base') }}\n\n),\nrow_values as (\n select * from {{ ref('series_10') }}\n),\nadd_row_values as (\n\n select\n cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_day,\n cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value\n from\n dates d\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_expectations.type_datetime", "macro.dbt_expectations.rand", "macro.dbt_utils.type_float", "macro.dbt_expectations.log_natural"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_base", "model.dbt_expectations_integration_tests.series_10"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_expectations_integration_tests", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "dbt_expectations_integration_tests", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "timeseries_data_extended"], "unique_id": "model.dbt_expectations_integration_tests.timeseries_data_extended", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "schema_tests/timeseries_data_extended.sql", "original_file_path": "models/schema_tests/timeseries_data_extended.sql", "name": "timeseries_data_extended", "alias": "timeseries_data_extended", "checksum": {"name": "sha256", "checksum": "e15b0350dc0add4038a20bbcdc2a9269a98c079220c4ec2169a3fedd86d18596"}, "tags": [], "refs": [["timeseries_base"], ["series_10"]], "sources": [], "description": "", "columns": {"date_day": {"name": "date_day", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "row_value": {"name": "row_value", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "row_value_log": {"name": "row_value_log", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "dbt_expectations_integration_tests://models/schema_tests/schema.yml", "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/timeseries_data_extended.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "dbt_expectations_integration_tests", "materialized": "table"}, "created_at": 1649080791.1425412, "compiled_sql": "with dates as (\n\n select * from postgres.dbt_expectations_integration_tests.timeseries_base\n\n),\nrow_values as (\n select * from postgres.dbt_expectations_integration_tests.series_10\n),\nadd_row_values as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n cast(abs(\n\n random()\n) as \n float\n) as row_value\n from\n dates d\n cross join\n row_values r\n\n),\nadd_logs as (\n\n select\n *,\n \n\n ln(nullif(row_value, 0))\n as row_value_log\n from\n add_row_values\n)\nselect\n *\nfrom\n add_logs", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "postgres.dbt_expectations_integration_tests.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_match_regex(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480\") }}", "test_metadata": {"name": "expect_column_values_to_match_regex", "kwargs": {"regex": "@[^.]*", "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_match_regex", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_match_regex_emails_email_address___"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_match_regex_emails_email_address___", "alias": "dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_2bafb3030a37be5cc212c866e5ed0480"}, "created_at": 1649080791.158848, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\n\n \narray_length((select regexp_matches(email_address, '@[^.]*')), 1)\n\n\n > 0\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_match_regex(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d\") }}", "test_metadata": {"name": "expect_column_values_to_not_match_regex", "kwargs": {"regex": "&[^.]*", "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_match_regex", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___", "alias": "dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_4b7e09b3a33bb51166bd757f627d9b5d"}, "created_at": 1649080791.179174, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\n\n \narray_length((select regexp_matches(email_address, '&[^.]*')), 1)\n\n\n = 0\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_match_regex_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd\") }}", "test_metadata": {"name": "expect_column_values_to_match_regex_list", "kwargs": {"regex_list": ["@[^.]*", "&[^.]*"], "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_match_regex_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______", "alias": "dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_be3692144f49c49868927f871016d3fd"}, "created_at": 1649080791.185843, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n \n \n\n \narray_length((select regexp_matches(email_address, '@[^.]*')), 1)\n\n\n > 0\n or \n \n \n\n \narray_length((select regexp_matches(email_address, '&[^.]*')), 1)\n\n\n > 0\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_match_regex_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff\") }}", "test_metadata": {"name": "expect_column_values_to_not_match_regex_list", "kwargs": {"regex_list": ["@[^.]*", "&[^.]*"], "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______", "alias": "dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_e2cc086be2c9b850d8617b27897508ff"}, "created_at": 1649080791.194467, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\n\n\n \narray_length((select regexp_matches(email_address, '@[^.]*')), 1)\n\n\n = 0\n or \n\n\n\n \narray_length((select regexp_matches(email_address, '&[^.]*')), 1)\n\n\n = 0\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_match_like_pattern(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e\") }}", "test_metadata": {"name": "expect_column_values_to_match_like_pattern", "kwargs": {"like_pattern": "%@%", "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_match_like_pattern", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___", "alias": "dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_66c2f74a45dedfb6a0976f3960592b2e"}, "created_at": 1649080791.202343, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \nemail_address like '%@%'\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_match_like_pattern(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd\") }}", "test_metadata": {"name": "expect_column_values_to_not_match_like_pattern", "kwargs": {"like_pattern": "%&%", "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___", "alias": "dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_48a06c8176781918327ec96b2a6ae2cd"}, "created_at": 1649080791.2097762, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \nemail_address not like '%&%'\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_match_like_pattern_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_bf499d536590ee781c76a572315de956\") }}", "test_metadata": {"name": "expect_column_values_to_match_like_pattern_list", "kwargs": {"like_pattern_list": ["%@%", "%&%"], "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_bf499d536590ee781c76a572315de956", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_bf499d536590ee781c76a572315de956.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______", "alias": "dbt_expectations_expect_column_bf499d536590ee781c76a572315de956", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_bf499d536590ee781c76a572315de956.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_bf499d536590ee781c76a572315de956"}, "created_at": 1649080791.216635, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n \n \nemail_address like '%@%'\n\n or \n \n \nemail_address like '%&%'\n\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7\") }}", "test_metadata": {"name": "expect_column_values_to_not_match_like_pattern_list", "kwargs": {"like_pattern_list": ["%@%", "%&%"], "column_name": "email_address", "model": "{{ get_where_subquery(ref('emails')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.emails"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______", "alias": "dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["emails"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_854e9090791330dc01170c9373995ce7"}, "created_at": 1649080791.225037, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n \n \nemail_address not like '%@%'\n\n or \n \n \nemail_address not like '%&%'\n\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.emails\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "email_address", "file_key_name": "models.emails"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa\") }}", "test_metadata": {"name": "expect_row_values_to_have_recent_data", "kwargs": {"datepart": "day", "interval": 1, "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1", "alias": "dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_23aaf8443c8d15f6e320bec0ef1f3aaa"}, "created_at": 1649080791.233748, "compiled_sql": "\n\n with max_recency as (\n\n select max(cast(date_day as timestamp without time zone)) as max_timestamp\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n where\n cast(date_day as timestamp without time zone) <= cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone)\n \n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('1970-01-01' as timestamp without time zone))\n <\n cast(\n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n as timestamp without time zone)\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_type_list", "kwargs": {"column_type_list": ["date", "{{ dbt_expectations.type_timestamp() }}"], "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_timestamp"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_", "alias": "dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_837727f0f2d148961efd320d1e7831af"}, "created_at": 1649080791.244908, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_DAY' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_DATETIME' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_TIMESTAMP' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_DAY'\n and\n relation_column_type not in ('DATE', 'TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_increasing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5\") }}", "test_metadata": {"name": "expect_column_values_to_be_increasing", "kwargs": {"sort_column": "date_day", "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_increasing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day", "alias": "dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_915dfb9e2254099b3af9caf4141b33a5"}, "created_at": 1649080791.253689, "compiled_sql": "with all_values as (\n\n select\n date_day as sort_column,\n date_day as value_field\n from postgres.dbt_expectations_integration_tests.timeseries_data\n \n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field > value_field_lag)\n\n)\nselect *\nfrom validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_count_to_equal_other_table(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c\") }}", "test_metadata": {"name": "expect_column_distinct_count_to_equal_other_table", "kwargs": {"compare_model": "ref(\"timeseries_data_extended\")", "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended", "model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_", "alias": "dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"], ["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_3edaa1ecaf7bbf66cd8c73b0912ce25c"}, "created_at": 1649080791.262006, "compiled_sql": "\n with a as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n \n\n ),\n b as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended\n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54\") }}", "test_metadata": {"name": "expect_row_values_to_have_recent_data", "kwargs": {"datepart": "day", "interval": 1, "column_name": "date_datetime", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1", "alias": "dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_aa49d620b84b67b5dab2fba206867d54"}, "created_at": 1649080791.282604, "compiled_sql": "\n\n with max_recency as (\n\n select max(cast(date_datetime as timestamp without time zone)) as max_timestamp\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n where\n cast(date_datetime as timestamp without time zone) <= cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone)\n \n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('1970-01-01' as timestamp without time zone))\n <\n cast(\n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n as timestamp without time zone)\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_datetime", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_type_list", "kwargs": {"column_type_list": ["date", "{{ dbt_expectations.type_datetime() }}"], "column_name": "date_datetime", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_", "alias": "dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_1cfed4d5a72647b089bb8ff513269498"}, "created_at": 1649080791.288034, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_DAY' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_DATETIME' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_TIMESTAMP' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_DATETIME'\n and\n relation_column_type not in ('DATE', 'TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_datetime", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59\") }}", "test_metadata": {"name": "expect_row_values_to_have_recent_data", "kwargs": {"datepart": "day", "interval": 1, "column_name": "date_timestamp", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1", "alias": "dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_bd5bfd3704842cc90136c80223125d59"}, "created_at": 1649080791.292659, "compiled_sql": "\n\n with max_recency as (\n\n select max(cast(date_timestamp as timestamp without time zone)) as max_timestamp\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n where\n cast(date_timestamp as timestamp without time zone) <= cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone)\n \n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('1970-01-01' as timestamp without time zone))\n <\n cast(\n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n as timestamp without time zone)\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_timestamp", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_type_list", "kwargs": {"column_type_list": ["date", "{{ dbt_expectations.type_timestamp() }}"], "column_name": "date_timestamp", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_timestamp"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_", "alias": "dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_390c5968031d3a12d537ab647e920d50"}, "created_at": 1649080791.298888, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_DAY' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_DATETIME' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('DATE_TIMESTAMP' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_TIMESTAMP'\n and\n relation_column_type not in ('DATE', 'TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_timestamp", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_within_n_stdevs(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c\") }}", "test_metadata": {"name": "expect_column_values_to_be_within_n_stdevs", "kwargs": {"sigma_threshold": 6, "column_name": "row_value", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6", "alias": "dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_5442cc4cdb958512adad79a84cf7a30c"}, "created_at": 1649080791.3034801, "compiled_sql": "\nwith metric_values as (\n\n select\n row_value as row_value\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n\n),\nmetric_values_with_statistics as (\n\n select\n *,\n avg(row_value) over() as row_value_average,\n stddev(row_value) over() as row_value_stddev\n from\n metric_values\n\n),\nmetric_values_z_scores as (\n\n select\n *,\n (row_value - row_value_average)/row_value_stddev as row_value_sigma\n from\n metric_values_with_statistics\n\n)\nselect\n *\nfrom\n metric_values_z_scores\nwhere\n abs(row_value_sigma) > 6", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe\") }}", "test_metadata": {"name": "expect_column_values_to_be_within_n_moving_stdevs", "kwargs": {"date_column_name": "date_day", "sigma_threshold": 6, "take_logs": true, "column_name": "row_value", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True", "alias": "dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe.sql", "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "dbt_expectations_expect_column_05317438a1bc527d03e6fe64a03e8ebe"}, "created_at": 1649080791.312373, "compiled_sql": "with metric_values as (\n\n with grouped_metric_values as (\n\n select\n \n date_trunc('day', date_day)\n as metric_period,\n sum(row_value) as agg_metric_value\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n group by\n 1\n\n ),\n grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, 1) over(order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n coalesce(\n\n ln(nullif(agg_metric_value, 0))\n, 0)\n -\n coalesce(\n\n ln(nullif(prior_agg_metric_value, 0))\n, 0)\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over(order by metric_period rows\n between 7 preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over(order by metric_period rows\n between 7 preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n \n\n \n date_trunc('day', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n + ((interval '1 day') * (-14))\n\n\n as timestamp without time zone)\n and\n metric_period < \n date_trunc('day', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n\n and\n\n not (\n metric_test_sigma >= -6 and\n metric_test_sigma <= 6\n )", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value", "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_match_ordered_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c\") }}", "test_metadata": {"name": "expect_table_columns_to_match_ordered_list", "kwargs": {"column_list": ["date_day", "date_datetime", "date_timestamp", "row_value", "row_value_log"], "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log", "alias": "dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__621ef6bb868bff0c481d279dd102649c"}, "created_at": 1649080791.331075, "compiled_sql": "with relation_columns as (\n\n \n select\n 1 as relation_column_idx,\n cast('DATE_DAY' as \n varchar\n) as relation_column\n union all\n \n select\n 2 as relation_column_idx,\n cast('DATE_DATETIME' as \n varchar\n) as relation_column\n union all\n \n select\n 3 as relation_column_idx,\n cast('DATE_TIMESTAMP' as \n varchar\n) as relation_column\n union all\n \n select\n 4 as relation_column_idx,\n cast('ROW_VALUE' as \n varchar\n) as relation_column\n union all\n \n select\n 5 as relation_column_idx,\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select\n 1 as input_column_idx,\n cast('DATE_DAY' as \n varchar\n) as input_column\n union all\n \n select\n 2 as input_column_idx,\n cast('DATE_DATETIME' as \n varchar\n) as input_column\n union all\n \n select\n 3 as input_column_idx,\n cast('DATE_TIMESTAMP' as \n varchar\n) as input_column\n union all\n \n select\n 4 as input_column_idx,\n cast('ROW_VALUE' as \n varchar\n) as input_column\n union all\n \n select\n 5 as input_column_idx,\n cast('ROW_VALUE_LOG' as \n varchar\n) as input_column\n \n \n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_count_to_equal_other_table(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229\") }}", "test_metadata": {"name": "expect_column_distinct_count_to_equal_other_table", "kwargs": {"column_name": "date_day", "compare_model": "ref(\"timeseries_data_extended\")", "compare_column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended", "model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_", "alias": "dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"], ["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_533122a91f29765fd6848c3ff572a229"}, "created_at": 1649080791.3407319, "compiled_sql": "\n with a as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n \n\n ),\n b as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended\n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_count_to_equal_other_table(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84\") }}", "test_metadata": {"name": "expect_column_distinct_count_to_equal_other_table", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day", "alias": "dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_ecf05a8ee93aef75b0e34757b4fdec84"}, "created_at": 1649080791.346338, "compiled_sql": "\n with a as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n \n\n ),\n b as (\n \n select\n \n count(distinct date_day) as expression\n from\n postgres.dbt_expectations_integration_tests.timeseries_data\n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0\") }}", "test_metadata": {"name": "expect_row_values_to_have_data_for_every_n_datepart", "kwargs": {"date_col": "date_day", "date_part": "day", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day", "alias": "dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_71f4b45998e8bf5ad45db7ce6b2f0ea0"}, "created_at": 1649080791.350661, "compiled_sql": "\n\n\n \n\n\n\n\n\n\n\n\n\nwith base_dates as (\n\n \n with date_spine as\n(\n\n \n\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 + 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 <= 366\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast('2021-04-02' as timestamp without time zone) + ((interval '1 day') * (row_number() over (order by 1) - 1))\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 <= cast('2022-04-03' as timestamp without time zone)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_day as timestamp without time zone) as date_day\nfrom\n date_spine d\n\n\n \n\n),\nmodel_data as (\n\n select\n \n\n cast(\n date_trunc('day', date_day)\n as timestamp without time zone) as date_day,\n\n \n \n count(*) as row_cnt\n from\n postgres.dbt_expectations_integration_tests.timeseries_data f\n \n group by\n date_day\n\n),\n\nfinal as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n case when f.date_day is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_day as timestamp without time zone) = f.date_day\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96\") }}", "test_metadata": {"name": "expect_row_values_to_have_data_for_every_n_datepart", "kwargs": {"date_col": "date_day", "date_part": "day", "exclusion_condition": "not(date_day = '2021-10-19')", "model": "{{ get_where_subquery(ref('timeseries_data')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_", "alias": "dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_0bed3b6651bb9f7221c899e2d56e5f96"}, "created_at": 1649080791.371095, "compiled_sql": "\n\n\n \n\n\n\n\n\n\n\n\n\nwith base_dates as (\n\n \n with date_spine as\n(\n\n \n\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 + 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 <= 366\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast('2021-04-02' as timestamp without time zone) + ((interval '1 day') * (row_number() over (order by 1) - 1))\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 <= cast('2022-04-03' as timestamp without time zone)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_day as timestamp without time zone) as date_day\nfrom\n date_spine d\n\n\n \n\n),\nmodel_data as (\n\n select\n \n\n cast(\n date_trunc('day', date_day)\n as timestamp without time zone) as date_day,\n\n \n \n count(*) as row_cnt\n from\n postgres.dbt_expectations_integration_tests.timeseries_data f\n \n group by\n date_day\n\n),\n\nfinal as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n case when f.date_day is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_day as timestamp without time zone) = f.date_day\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n\n and not(date_day = '2021-10-19')\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755\") }}", "test_metadata": {"name": "expect_row_values_to_have_recent_data", "kwargs": {"datepart": "day", "interval": 1, "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1", "alias": "dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_31021e665736eb4eeb7b81c8a3d40755"}, "created_at": 1649080791.376044, "compiled_sql": "\n\n with max_recency as (\n\n select max(cast(date_day as timestamp without time zone)) as max_timestamp\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended\n where\n cast(date_day as timestamp without time zone) <= cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone)\n \n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('1970-01-01' as timestamp without time zone))\n <\n cast(\n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n as timestamp without time zone)\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d\") }}", "test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "{{ dbt_expectations.type_datetime() }}", "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_", "alias": "dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_b11cefb7a4df24c6744f6a652502dd8d"}, "created_at": 1649080791.382406, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_DAY' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_DAY'\n and\n relation_column_type not in ('TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_type_list", "kwargs": {"column_type_list": ["date", "{{ dbt_expectations.type_datetime() }}"], "column_name": "date_day", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_", "alias": "dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_e6bd8a874a72fd7d31719d3d13064790"}, "created_at": 1649080791.387858, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_DAY' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_DAY'\n and\n relation_column_type not in ('DATE', 'TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_count_to_equal(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849\") }}", "test_metadata": {"name": "expect_column_distinct_count_to_equal", "kwargs": {"row_condition": "date_day = {{ dbt_date.yesterday() }}", "value": 10, "column_name": "row_value", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_count_to_equal", "macro.dbt.get_where_subquery", "macro.dbt_date.yesterday"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10", "alias": "dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_5962522b7fc265dccebfd2e53995c849"}, "created_at": 1649080791.392534, "compiled_sql": "\n\n\n with grouped_expression as (\n select\n \n \n \n \ncount(distinct row_value) = 10\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.timeseries_data_extended\n where\n date_day = cast(\n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (-1))\n\n as date)\n \n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_count_to_be_greater_than(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2\") }}", "test_metadata": {"name": "expect_column_distinct_count_to_be_greater_than", "kwargs": {"row_condition": "date_day = {{ dbt_date.yesterday() }}", "value": 1, "column_name": "row_value", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than", "macro.dbt.get_where_subquery", "macro.dbt_date.yesterday"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1", "alias": "dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_eba4a4c027cd681bc97d36e2e9320fe2"}, "created_at": 1649080791.400269, "compiled_sql": "\n\n\n with grouped_expression as (\n select\n \n \n \n \ncount(distinct row_value) > 1\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.timeseries_data_extended\n where\n date_day = cast(\n\n cast(cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) as date) + ((interval '1 day') * (-1))\n\n as date)\n \n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76\") }}", "test_metadata": {"name": "expect_column_values_to_be_within_n_moving_stdevs", "kwargs": {"date_column_name": "cast(date_day as {{ dbt_expectations.type_datetime() }})", "sigma_threshold": 6, "take_logs": false, "column_name": "row_value_log", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False", "alias": "dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76.sql", "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "dbt_expectations_expect_column_7c415d95f2676319d2bdb189bcbcaa76"}, "created_at": 1649080791.4070761, "compiled_sql": "with metric_values as (\n\n with grouped_metric_values as (\n\n select\n \n date_trunc('day', cast(date_day as timestamp without time zone))\n as metric_period,\n sum(row_value_log) as agg_metric_value\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended\n group by\n 1\n\n ),\n grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, 1) over(order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n coalesce(agg_metric_value, 0)\n -\n coalesce(prior_agg_metric_value, 0)\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over(order by metric_period rows\n between 7 preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over(order by metric_period rows\n between 7 preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n \n\n \n date_trunc('day', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n + ((interval '1 day') * (-14))\n\n\n as timestamp without time zone)\n and\n metric_period < \n date_trunc('day', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n\n and\n\n not (\n metric_test_sigma >= -6 and\n metric_test_sigma <= 6\n )", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value_log", "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_match_ordered_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12\") }}", "test_metadata": {"name": "expect_table_columns_to_match_ordered_list", "kwargs": {"column_list": ["date_day", "row_value", "row_value_log"], "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log", "alias": "dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__bb7eb401e16c326c4b1bb599f8343f12"}, "created_at": 1649080791.4145868, "compiled_sql": "with relation_columns as (\n\n \n select\n 1 as relation_column_idx,\n cast('DATE_DAY' as \n varchar\n) as relation_column\n union all\n \n select\n 2 as relation_column_idx,\n cast('ROW_VALUE' as \n varchar\n) as relation_column\n union all\n \n select\n 3 as relation_column_idx,\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select\n 1 as input_column_idx,\n cast('DATE_DAY' as \n varchar\n) as input_column\n union all\n \n select\n 2 as input_column_idx,\n cast('ROW_VALUE' as \n varchar\n) as input_column\n union all\n \n select\n 3 as input_column_idx,\n cast('ROW_VALUE_LOG' as \n varchar\n) as input_column\n \n \n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62\") }}", "test_metadata": {"name": "expect_row_values_to_have_data_for_every_n_datepart", "kwargs": {"date_col": "date_day", "date_part": "day", "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day", "alias": "dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_106138db9c125c3e786274b02c6b0b62"}, "created_at": 1649080791.4194849, "compiled_sql": "\n\n\n \n\n\n\n\n\n\n\n\n\nwith base_dates as (\n\n \n with date_spine as\n(\n\n \n\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 + 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 <= 366\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast('2021-04-02' as timestamp without time zone) + ((interval '1 day') * (row_number() over (order by 1) - 1))\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 <= cast('2022-04-03' as timestamp without time zone)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_day as timestamp without time zone) as date_day\nfrom\n date_spine d\n\n\n \n\n),\nmodel_data as (\n\n select\n \n\n cast(\n date_trunc('day', date_day)\n as timestamp without time zone) as date_day,\n\n \n \n count(*) as row_cnt\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended f\n \n group by\n date_day\n\n),\n\nfinal as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n case when f.date_day is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_day as timestamp without time zone) = f.date_day\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3\") }}", "test_metadata": {"name": "expect_row_values_to_have_data_for_every_n_datepart", "kwargs": {"date_col": "date_day", "date_part": "day", "interval": 7, "model": "{{ get_where_subquery(ref('timeseries_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7", "alias": "dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_a6fa9f8b8c0c964d84c26185c0dab7f3"}, "created_at": 1649080791.424042, "compiled_sql": "\n\n\n \n\n\n\n\n\n\n\n\n\nwith base_dates as (\n\n \n with date_spine as\n(\n\n \n\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 + 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 <= 366\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast('2021-04-02' as timestamp without time zone) + ((interval '1 day') * (row_number() over (order by 1) - 1))\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 <= cast('2022-04-03' as timestamp without time zone)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_day as timestamp without time zone) as date_day\nfrom\n date_spine d\n\n\n \n \n where mod(\n cast(\n\n \n ((date_day)::date - ('2021-04-02')::date)\n \n\n as \n int\n),\n cast(7 as \n int\n)\n ) = 0\n \n\n),\nmodel_data as (\n\n select\n \n \n \n\n cast( \n date_trunc('day', date_day)\n as timestamp without time zone) + ((interval '1 day') * (mod(\n cast(\n\n \n ((date_day)::date - ('2021-04-02')::date)\n \n\n as \n int\n ),\n cast(7 as \n int\n )\n ) * (-1)))\n\n as date_day,\n \n \n \n count(*) as row_cnt\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_extended f\n \n group by\n date_day\n\n),\n\nfinal as (\n\n select\n cast(d.date_day as timestamp without time zone) as date_day,\n case when f.date_day is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_day as timestamp without time zone) = f.date_day\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0\") }}", "test_metadata": {"name": "expect_row_values_to_have_recent_data", "kwargs": {"datepart": "hour", "interval": 24, "column_name": "date_hour", "model": "{{ get_where_subquery(ref('timeseries_hourly_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24", "alias": "dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_hourly_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_e83053a68d0839ba2770091346e239e0"}, "created_at": 1649080791.429743, "compiled_sql": "\n\n with max_recency as (\n\n select max(cast(date_hour as timestamp without time zone)) as max_timestamp\n from\n postgres.dbt_expectations_integration_tests.timeseries_hourly_data_extended\n where\n cast(date_hour as timestamp without time zone) <= cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone)\n \n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('1970-01-01' as timestamp without time zone))\n <\n cast(\n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 hour') * (-24))\n\n as timestamp without time zone)\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_hour", "file_key_name": "models.timeseries_hourly_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7\") }}", "test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "{{ dbt_expectations.type_datetime() }}", "column_name": "date_hour", "model": "{{ get_where_subquery(ref('timeseries_hourly_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_", "alias": "dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_hourly_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_ac12dae9db4305a229f7b7a1c1e11ab7"}, "created_at": 1649080791.435206, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_HOUR' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_HOUR'\n and\n relation_column_type not in ('TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_hour", "file_key_name": "models.timeseries_hourly_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_type_list", "kwargs": {"column_type_list": ["{{ dbt_expectations.type_datetime() }}"], "column_name": "date_hour", "model": "{{ get_where_subquery(ref('timeseries_hourly_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_", "alias": "dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_hourly_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_68bee2c1f6c7d428f2e8e7c95a91e931"}, "created_at": 1649080791.439601, "compiled_sql": "with relation_columns as (\n\n \n select\n cast('DATE_HOUR' as \n varchar\n) as relation_column,\n cast('TIMESTAMP WITHOUT TIME ZONE' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n union all\n \n select\n cast('ROW_VALUE_LOG' as \n varchar\n) as relation_column,\n cast('DOUBLE PRECISION' as \n varchar\n) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'DATE_HOUR'\n and\n relation_column_type not in ('TIMESTAMP WITHOUT TIME ZONE')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_hour", "file_key_name": "models.timeseries_hourly_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a\") }}", "test_metadata": {"name": "expect_column_values_to_be_within_n_moving_stdevs", "kwargs": {"date_column_name": "cast(date_hour as {{ dbt_expectations.type_datetime() }})", "period": "hour", "trend_periods": 48, "test_periods": 12, "sigma_threshold": 6, "take_logs": false, "column_name": "row_value_log", "model": "{{ get_where_subquery(ref('timeseries_hourly_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "macro.dbt.get_where_subquery", "macro.dbt_expectations.type_datetime"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48", "alias": "dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_hourly_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a.sql", "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "dbt_expectations_expect_column_0493856fc462613817b49ef69dd9c58a"}, "created_at": 1649080791.444271, "compiled_sql": "with metric_values as (\n\n with grouped_metric_values as (\n\n select\n \n date_trunc('hour', cast(date_hour as timestamp without time zone))\n as metric_period,\n sum(row_value_log) as agg_metric_value\n from\n postgres.dbt_expectations_integration_tests.timeseries_hourly_data_extended\n group by\n 1\n\n ),\n grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, 1) over(order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n coalesce(agg_metric_value, 0)\n -\n coalesce(prior_agg_metric_value, 0)\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over(order by metric_period rows\n between 48 preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over(order by metric_period rows\n between 48 preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n \n\n \n date_trunc('hour', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n + ((interval '1 hour') * (-12))\n\n\n as timestamp without time zone)\n and\n metric_period < \n date_trunc('hour', cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone))\n\n and\n\n not (\n metric_test_sigma >= -6 and\n metric_test_sigma <= 6\n )", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "row_value_log", "file_key_name": "models.timeseries_hourly_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404": {"raw_sql": "{{ dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7\") }}", "test_metadata": {"name": "expect_row_values_to_have_data_for_every_n_datepart", "kwargs": {"date_col": "date_hour", "date_part": "hour", "model": "{{ get_where_subquery(ref('timeseries_hourly_data_extended')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour", "alias": "dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_hourly_data_extended"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_row_va_66b01d2da7995f5a7de822fb58e15ce7"}, "created_at": 1649080791.4514098, "compiled_sql": "\n\n\n \n\n\n\n\n\n\n\n\n\nwith base_dates as (\n\n \n with date_spine as\n(\n\n \n\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 + 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 <= 240.0\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n cast('2022-03-24' as timestamp without time zone) + ((interval '1 hour') * (row_number() over (order by 1) - 1))\n\n\n ) as date_hour\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_hour <= cast('2022-04-03' as timestamp without time zone)\n\n)\n\nselect * from filtered\n\n\n\n)\nselect\n cast(d.date_hour as timestamp without time zone) as date_hour\nfrom\n date_spine d\n\n\n \n\n),\nmodel_data as (\n\n select\n \n\n cast(\n date_trunc('hour', date_hour)\n as timestamp without time zone) as date_hour,\n\n \n \n count(*) as row_cnt\n from\n postgres.dbt_expectations_integration_tests.timeseries_hourly_data_extended f\n \n group by\n date_hour\n\n),\n\nfinal as (\n\n select\n cast(d.date_hour as timestamp without time zone) as date_hour,\n case when f.date_hour is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_hour as timestamp without time zone) = f.date_hour\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_hourly_data_extended"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806": {"raw_sql": "{{ dbt_expectations.test_expect_column_to_exist(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "expect_column_to_exist", "kwargs": {"column_index": 1, "column_name": "idx", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_to_exist", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_to_exist_data_test_1__idx"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_to_exist_data_test_1__idx.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_to_exist_data_test_1__idx", "alias": "dbt_expectations_expect_column_to_exist_data_test_1__idx", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_to_exist_data_test_1__idx.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1649080791.455966, "compiled_sql": "\n\n with test_data as (\n\n select\n cast('IDX' as \n varchar\n) as column_name,\n 0 as matching_column_index,\n True as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "idx", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff\") }}", "test_metadata": {"name": "expect_column_values_to_be_unique", "kwargs": {"column_name": "idx", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_unique_data_test_idx"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_unique_data_test_idx", "alias": "dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_d6985a2dd161d3de837fd7a792e250ff"}, "created_at": 1649080791.46432, "compiled_sql": "\n\n\n\n\n\n\n\nwith validation_errors as (\n\n select\n idx\n from postgres.dbt_expectations_integration_tests.data_test\n where 1=1\n \n group by\n idx\n having count(*) > 1\n\n)\nselect * from validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "idx", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_increasing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49\") }}", "test_metadata": {"name": "expect_column_values_to_be_increasing", "kwargs": {"sort_column": "idx", "column_name": "idx", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_increasing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx", "alias": "dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_2aec33d274059303ee418d03cd5b0d49"}, "created_at": 1649080791.476623, "compiled_sql": "with all_values as (\n\n select\n idx as sort_column,\n idx as value_field\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field > value_field_lag)\n\n)\nselect *\nfrom validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "idx", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef": {"raw_sql": "{{ dbt_expectations.test_expect_column_to_exist(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "expect_column_to_exist", "kwargs": {"column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_to_exist", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_to_exist_data_test_col_numeric_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_to_exist_data_test_col_numeric_a", "alias": "dbt_expectations_expect_column_to_exist_data_test_col_numeric_a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1649080791.481662, "compiled_sql": "\n\n with test_data as (\n\n select\n cast('COL_NUMERIC_A' as \n varchar\n) as column_name,\n 2 as matching_column_index,\n True as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9": {"raw_sql": "{{ dbt_expectations.test_expect_column_to_exist(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422\") }}", "test_metadata": {"name": "expect_column_to_exist", "kwargs": {"column_index": 3, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_to_exist", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a", "alias": "dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_4ac93c8961fe07fef8be60820d47a422"}, "created_at": 1649080791.4850109, "compiled_sql": "\n\n with test_data as (\n\n select\n cast('COL_NUMERIC_A' as \n varchar\n) as column_name,\n 2 as matching_column_index,\n True as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_be_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a\") }}", "test_metadata": {"name": "expect_column_values_to_not_be_null", "kwargs": {"column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_be_null", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a", "alias": "dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_f9cc2553c3f7be5306b0ba058123a38a"}, "created_at": 1649080791.489275, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n col_numeric_a is not null as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c\") }}", "test_metadata": {"name": "expect_column_values_to_be_between", "kwargs": {"min_value": 0, "max_value": 1, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0", "alias": "dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_82e2a3dc577c3b6000c4507dea3c9f5c"}, "created_at": 1649080791.49541, "compiled_sql": "\n\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and col_numeric_a >= 0 and col_numeric_a <= 1\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43\") }}", "test_metadata": {"name": "expect_column_values_to_be_between", "kwargs": {"min_value": 0, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0", "alias": "dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_33c7237f7ccbf6f7fbc046ab4847dd43"}, "created_at": 1649080791.5060139, "compiled_sql": "\n\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and col_numeric_a >= 0\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1": {"raw_sql": "{{ dbt_expectations.test_expect_column_sum_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2\") }}", "test_metadata": {"name": "expect_column_sum_to_be_between", "kwargs": {"min_value": 1, "max_value": 3, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_sum_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1", "alias": "dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_1a9fa430f4b86b3f240d87bd2aa95ac2"}, "created_at": 1649080791.510242, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and sum(col_numeric_a) >= 1 and sum(col_numeric_a) <= 3\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44": {"raw_sql": "{{ dbt_expectations.test_expect_column_min_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56\") }}", "test_metadata": {"name": "expect_column_min_to_be_between", "kwargs": {"min_value": 0, "max_value": 0, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_min_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0", "alias": "dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_0f21475a39564b7f0f28389630488e56"}, "created_at": 1649080791.5178711, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and min(col_numeric_a) >= 0 and min(col_numeric_a) <= 0\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb": {"raw_sql": "{{ dbt_expectations.test_expect_column_max_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4\") }}", "test_metadata": {"name": "expect_column_max_to_be_between", "kwargs": {"min_value": 1, "max_value": 1, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_max_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1", "alias": "dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_3e45cc658bb26429cb14265549bb8aa4"}, "created_at": 1649080791.524419, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and max(col_numeric_a) >= 1 and max(col_numeric_a) <= 1\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309": {"raw_sql": "{{ dbt_expectations.test_expect_column_mean_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c\") }}", "test_metadata": {"name": "expect_column_mean_to_be_between", "kwargs": {"min_value": 0, "max_value": 1.5, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_mean_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0", "alias": "dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_67c79a4933f6133e5d7dc197aa5ce58c"}, "created_at": 1649080791.531901, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and avg(col_numeric_a) >= 0 and avg(col_numeric_a) <= 1.5\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765": {"raw_sql": "{{ dbt_expectations.test_expect_column_unique_value_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95\") }}", "test_metadata": {"name": "expect_column_unique_value_count_to_be_between", "kwargs": {"min_value": 3, "max_value": 3, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3", "alias": "dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_d615c4d661054a359cf59514a5767d95"}, "created_at": 1649080791.5384388, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(distinct col_numeric_a) >= 3 and count(distinct col_numeric_a) <= 3\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5": {"raw_sql": "{{ dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4\") }}", "test_metadata": {"name": "expect_column_proportion_of_unique_values_to_be_between", "kwargs": {"min_value": 0, "max_value": 0.75, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0", "alias": "dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_aac06c6794794584dc7a7928e0fd4cf4"}, "created_at": 1649080791.545283, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(distinct col_numeric_a)/count(col_numeric_a) >= 0 and count(distinct col_numeric_a)/count(col_numeric_a) <= 0.75\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3": {"raw_sql": "{{ dbt_expectations.test_expect_column_stdev_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66\") }}", "test_metadata": {"name": "expect_column_stdev_to_be_between", "kwargs": {"min_value": 0, "max_value": 2, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_stdev_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0", "alias": "dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_d14e75b5d188a5e0fb41411693011f66"}, "created_at": 1649080791.5526028, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and stddev(col_numeric_a) >= 0 and stddev(col_numeric_a) <= 2\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83": {"raw_sql": "{{ dbt_expectations.test_expect_column_stdev_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf\") }}", "test_metadata": {"name": "expect_column_stdev_to_be_between", "kwargs": {"min_value": 0, "strictly": true, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_stdev_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True", "alias": "dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_9cb8509d48244202d6fe36303eda94cf"}, "created_at": 1649080791.5612118, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and stddev(col_numeric_a) > 0\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758": {"raw_sql": "{{ dbt_expectations.test_expect_column_most_common_value_to_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d\") }}", "test_metadata": {"name": "expect_column_most_common_value_to_be_in_set", "kwargs": {"value_set": [0.5], "top_n": 1, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5", "alias": "dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_251ddbc4d6ca6795c8564d815f1e643d"}, "created_at": 1649080791.5661912, "compiled_sql": "\n\nwith value_counts as (\n\n select\n cast(col_numeric_a as decimal) as value_field,\n count(*) as value_count\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n group by cast(col_numeric_a as decimal)\n\n),\nvalue_counts_ranked as (\n\n select\n *,\n row_number() over(order by value_count desc) as value_count_rank\n from\n value_counts\n\n),\nvalue_count_top_n as (\n\n select\n value_field\n from\n value_counts_ranked\n where\n value_count_rank = 1\n\n),\nset_values as (\n\n select\n cast(0.5 as decimal) as value_field\n \n \n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n value_field\n from\n value_count_top_n\n where\n value_field not in (select value_field from unique_set_values)\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_increasing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb\") }}", "test_metadata": {"name": "expect_column_values_to_be_increasing", "kwargs": {"sort_column": "col_numeric_a", "strictly": false, "column_name": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_increasing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False", "alias": "dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_f25d743864680a14bcbd0ad4616d5adb"}, "created_at": 1649080791.5775151, "compiled_sql": "with all_values as (\n\n select\n col_numeric_a as sort_column,\n col_numeric_a as value_field\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field >= value_field_lag)\n\n)\nselect *\nfrom validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_numeric_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096\") }}", "test_metadata": {"name": "expect_column_values_to_be_in_set", "kwargs": {"value_set": ["a", "b", "c"], "quote_values": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c", "alias": "dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_e22f43aabfaf6796be1cb5d13fefe096"}, "created_at": 1649080791.5825028, "compiled_sql": "\n\nwith all_values as (\n\n select\n col_string_a as value_field\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n cast('a' as \n varchar\n) as value_field\n union all\n select\n cast('b' as \n varchar\n) as value_field\n union all\n select\n cast('c' as \n varchar\n) as value_field\n \n \n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442\") }}", "test_metadata": {"name": "expect_column_values_to_not_be_in_set", "kwargs": {"value_set": ["2", "3"], "quote_values": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3", "alias": "dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_bf6e306da971dd490618afe3d21ef442"}, "created_at": 1649080791.590446, "compiled_sql": "\n\nwith all_values as (\n\n select\n col_string_a as value_field\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n cast('2' as \n varchar\n) as value_field\n union all\n select\n cast('3' as \n varchar\n) as value_field\n \n \n),\nvalidation_errors as (\n -- values from the model that match the set\n select\n v.value_field\n from\n all_values v\n join\n set_values s on v.value_field = s.value_field\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_values_to_equal_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296\") }}", "test_metadata": {"name": "expect_column_distinct_values_to_equal_set", "kwargs": {"value_set": ["a", "b", "c", "c"], "quote_values": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c", "alias": "dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_10c0f019d10a19bf6df858ec8aebe296"}, "created_at": 1649080791.598738, "compiled_sql": "\n\nwith all_values as (\n\n select distinct\n col_string_a as column_value\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n 'a' as value_field\n union all\n select\n 'b' as value_field\n union all\n select\n 'c' as value_field\n union all\n select\n 'c' as value_field\n \n \n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n all_values v\n full outer join\n unique_set_values s on v.column_value = s.value_field\n where\n v.column_value is null or\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_values_to_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1\") }}", "test_metadata": {"name": "expect_column_distinct_values_to_be_in_set", "kwargs": {"value_set": ["a", "b", "c", "d"], "quote_values": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d", "alias": "dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_0f9218728f5bbfe5e441a3bca5addea1"}, "created_at": 1649080791.606865, "compiled_sql": "\n\nwith all_values as (\n\n select distinct\n col_string_a as value_field\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n 'a' as value_field\n union all\n select\n 'b' as value_field\n union all\n select\n 'c' as value_field\n union all\n select\n 'd' as value_field\n \n \n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n unique_set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163": {"raw_sql": "{{ dbt_expectations.test_expect_column_distinct_values_to_contain_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823\") }}", "test_metadata": {"name": "expect_column_distinct_values_to_contain_set", "kwargs": {"value_set": ["a", "b"], "quote_values": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b", "alias": "dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_a09f887d8761d655adc9ca7cba0e6823"}, "created_at": 1649080791.6171288, "compiled_sql": "\n\nwith all_values as (\n\n select distinct\n col_string_a as value_field\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n 'a' as value_field\n union all\n select\n 'b' as value_field\n \n \n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values in set that are not in the list of values from the model\n select\n s.value_field\n from\n unique_set_values s\n left join\n all_values v on s.value_field = v.value_field\n where\n v.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db": {"raw_sql": "{{ dbt_expectations.test_expect_column_value_lengths_to_equal(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d\") }}", "test_metadata": {"name": "expect_column_value_lengths_to_equal", "kwargs": {"value": 1, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_value_lengths_to_equal", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1", "alias": "dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_d411e1248ff185e2ba281a42b356ef2d"}, "created_at": 1649080791.6243331, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n \n length(\n col_string_a\n ) = 1 as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_have_consistent_casing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447\") }}", "test_metadata": {"name": "expect_column_values_to_have_consistent_casing", "kwargs": {"column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a", "alias": "dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_3373c8840b5bda2e8b8ee904946b5447"}, "created_at": 1649080791.6330628, "compiled_sql": "\n\nwith test_data as (\n\n select\n distinct col_string_a as distinct_values\n from\n postgres.dbt_expectations_integration_tests.data_test\n\n ),\n \n validation_errors as (\n\n select\n count(1) as set_count,\n count(distinct lower(distinct_values)) as set_count_case_insensitive\n from\n test_data\n\n )\n select *\n from\n validation_errors\n where\n set_count != set_count_case_insensitive\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_have_consistent_casing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf\") }}", "test_metadata": {"name": "expect_column_values_to_have_consistent_casing", "kwargs": {"display_inconsistent_columns": true, "column_name": "col_string_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True", "alias": "dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_06c0c4c370e8c17e0abba946df1269bf"}, "created_at": 1649080791.63814, "compiled_sql": "\n\nwith test_data as (\n\n select\n distinct col_string_a as distinct_values\n from\n postgres.dbt_expectations_integration_tests.data_test\n\n ),\n \n validation_errors as (\n\n select\n lower(distinct_values) as inconsistent_columns,\n count(distinct_values) as set_count_case_insensitive\n from\n test_data\n group by 1\n having\n count(distinct_values) > 1\n\n )\n select * from validation_errors\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_a", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3\") }}", "test_metadata": {"name": "expect_column_values_to_not_be_in_set", "kwargs": {"value_set": ["a", "c"], "quote_values": true, "column_name": "col_string_b", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c", "alias": "dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_9d36e48a59ac12c3fe063714b1014af3"}, "created_at": 1649080791.641964, "compiled_sql": "\n\nwith all_values as (\n\n select\n col_string_b as value_field\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nset_values as (\n\n select\n cast('a' as \n varchar\n) as value_field\n union all\n select\n cast('c' as \n varchar\n) as value_field\n \n \n),\nvalidation_errors as (\n -- values from the model that match the set\n select\n v.value_field\n from\n all_values v\n join\n set_values s on v.value_field = s.value_field\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_b", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8": {"raw_sql": "{{ dbt_expectations.test_expect_column_value_lengths_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8\") }}", "test_metadata": {"name": "expect_column_value_lengths_to_be_between", "kwargs": {"min_value": 1, "max_value": 4, "column_name": "col_string_b", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1", "alias": "dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_18ea00e7c2c407d961bbe43497babdb8"}, "created_at": 1649080791.6470149, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and length(\n col_string_b\n ) >= 1 and length(\n col_string_b\n ) <= 4\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_b", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3": {"raw_sql": "{{ dbt_expectations.test_expect_column_value_lengths_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50\") }}", "test_metadata": {"name": "expect_column_value_lengths_to_be_between", "kwargs": {"min_value": 1, "column_name": "col_string_b", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1", "alias": "dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_3a97dc7d90dbd140877bdf1e7ca32c50"}, "created_at": 1649080791.654151, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and length(\n col_string_b\n ) >= 1\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_b", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a": {"raw_sql": "{{ dbt_expectations.test_expect_column_value_lengths_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8\") }}", "test_metadata": {"name": "expect_column_value_lengths_to_be_between", "kwargs": {"max_value": 4, "column_name": "col_string_b", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4", "alias": "dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_91dc2f6ab48783ee3a3a50b00105dba8"}, "created_at": 1649080791.6585531, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and length(\n col_string_b\n ) <= 4\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_string_b", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa\") }}", "test_metadata": {"name": "expect_column_values_to_be_null", "kwargs": {"column_name": "col_null", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_null", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_null_data_test_col_null"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_null_data_test_col_null", "alias": "dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_09d218d0d3d99cf85d4a97f1ab36f3fa"}, "created_at": 1649080791.663334, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n col_null is null as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "col_null", "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372": {"raw_sql": "{{ dbt_expectations.test_expect_compound_columns_to_be_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367\") }}", "test_metadata": {"name": "expect_compound_columns_to_be_unique", "kwargs": {"column_list": ["date_col", "col_string_b"], "ignore_row_if": "any_value_is_missing", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_compound_columns_to_be_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing", "alias": "dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_compou_771defe3ac738795eee3164f4d87f367"}, "created_at": 1649080791.669921, "compiled_sql": "\n\n\n\n\n\n\nwith validation_errors as (\n\n select\n date_col,col_string_b\n from postgres.dbt_expectations_integration_tests.data_test\n where 1=1\n \n group by\n date_col,col_string_b\n having count(*) > 1\n\n)\nselect * from validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_equal(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "expect_table_row_count_to_equal", "kwargs": {"value": 4, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_equal_data_test_4"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table_row_count_to_equal_data_test_4.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_equal_data_test_4", "alias": "dbt_expectations_expect_table_row_count_to_equal_data_test_4", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table_row_count_to_equal_data_test_4.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1649080791.674743, "compiled_sql": "\n\n with grouped_expression as (\n select\n \n \n \n \ncount(*) = 4\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"min_value": 1, "max_value": 4, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1", "alias": "dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__6b26b61d6d1e8a6cf638953327d27463"}, "created_at": 1649080791.682528, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(*) >= 1 and count(*) <= 4\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"min_value": 1, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_data_test_1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_data_test_1", "alias": "dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__73ef10f9f7d8dee7720cb8ebe2e37fca"}, "created_at": 1649080791.6892412, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(*) >= 1\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"max_value": 4, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_data_test_4"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_data_test_4", "alias": "dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__e6e699c05ec7a4b454cbc852ff49db08"}, "created_at": 1649080791.693457, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(*) <= 4\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923\") }}", "test_metadata": {"name": "expect_table_row_count_to_equal_other_table", "kwargs": {"compare_model": "ref(\"data_test\")", "row_condition": "1=1", "compare_row_condition": "1=1", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1", "alias": "dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__a465b53c9fff2c5dfb05a08186151923"}, "created_at": 1649080791.698664, "compiled_sql": "\n with a as (\n \n select\n \n count(*) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n where\n 1=1\n \n \n\n ),\n b as (\n \n select\n \n count(*) * 1 as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n where\n 1=1\n \n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555": {"raw_sql": "{{ dbt_expectations.test_expect_table_column_count_to_equal(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "expect_table_column_count_to_equal", "kwargs": {"value": 7, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_column_count_to_equal", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_column_count_to_equal_data_test_7"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table_column_count_to_equal_data_test_7.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_column_count_to_equal_data_test_7", "alias": "dbt_expectations_expect_table_column_count_to_equal_data_test_7", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table_column_count_to_equal_data_test_7.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1649080791.7060301, "compiled_sql": "with test_data as (\n\n select\n 7 as number_actual_columns,\n 7 as value\n\n)\nselect *\nfrom test_data\nwhere\n number_actual_columns != value", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff": {"raw_sql": "{{ dbt_expectations.test_expect_table_column_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f\") }}", "test_metadata": {"name": "expect_table_column_count_to_be_between", "kwargs": {"min_value": 1, "max_value": 10, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_column_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1", "alias": "dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__201b7d719f09d1a58472ee81604bc59f"}, "created_at": 1649080791.711179, "compiled_sql": "with test_data as (\n\n select\n 7 as number_actual_columns,\n 1 as min_value,\n 10 as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not \n( 1=1 and number_actual_columns >= min_value and number_actual_columns <= max_value\n)\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76": {"raw_sql": "{{ dbt_expectations.test_expect_table_column_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6\") }}", "test_metadata": {"name": "expect_table_column_count_to_be_between", "kwargs": {"min_value": 1, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_column_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_column_count_to_be_between_data_test_1"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_column_count_to_be_between_data_test_1", "alias": "dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__cca8b07a5019c1773be4b15221ab76d6"}, "created_at": 1649080791.718823, "compiled_sql": "with test_data as (\n\n select\n 7 as number_actual_columns,\n 1 as min_value,\n 0 as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not \n( 1=1 and number_actual_columns >= min_value\n)\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23": {"raw_sql": "{{ dbt_expectations.test_expect_table_column_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115\") }}", "test_metadata": {"name": "expect_table_column_count_to_be_between", "kwargs": {"max_value": 10, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_column_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_column_count_to_be_between_data_test_10"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_column_count_to_be_between_data_test_10", "alias": "dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__821193c730d0f28fd1cd9fc7a1b47115"}, "created_at": 1649080791.722705, "compiled_sql": "with test_data as (\n\n select\n 7 as number_actual_columns,\n 0 as min_value,\n 10 as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not \n( 1=1 and number_actual_columns <= max_value\n)\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_contain_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5\") }}", "test_metadata": {"name": "expect_table_columns_to_contain_set", "kwargs": {"column_list": ["col_numeric_b", "col_string_a"], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_contain_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a", "alias": "dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__2c8154b0d8ece670be3f3d047fdd3db5"}, "created_at": 1649080791.726445, "compiled_sql": "with relation_columns as (\n\n \n select cast('IDX' as \n varchar\n) as relation_column\n union all\n \n select cast('DATE_COL' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NULL' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select cast('COL_NUMERIC_B' as \n varchar\n) as input_column\n union all\n \n select cast('COL_STRING_A' as \n varchar\n) as input_column\n \n \n )\n select *\n from\n input_columns i\n left join\n relation_columns r on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n r.relation_column is null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_match_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3\") }}", "test_metadata": {"name": "expect_table_columns_to_match_set", "kwargs": {"column_list": ["idx", "date_col", "col_numeric_a", "col_numeric_b", "col_string_a", "col_string_b", "col_null"], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_match_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null", "alias": "dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__748d8ef68b7b77740e48848bbae1f5e3"}, "created_at": 1649080791.735646, "compiled_sql": "with relation_columns as (\n\n \n select cast('IDX' as \n varchar\n) as relation_column\n union all\n \n select cast('DATE_COL' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NULL' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select cast('IDX' as \n varchar\n) as input_column\n union all\n \n select cast('DATE_COL' as \n varchar\n) as input_column\n union all\n \n select cast('COL_NUMERIC_A' as \n varchar\n) as input_column\n union all\n \n select cast('COL_NUMERIC_B' as \n varchar\n) as input_column\n union all\n \n select cast('COL_STRING_A' as \n varchar\n) as input_column\n union all\n \n select cast('COL_STRING_B' as \n varchar\n) as input_column\n union all\n \n select cast('COL_NULL' as \n varchar\n) as input_column\n \n \n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n -- or any table column that is not in the input list\n r.relation_column is null or\n i.input_column is null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_match_ordered_list(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282\") }}", "test_metadata": {"name": "expect_table_columns_to_match_ordered_list", "kwargs": {"column_list": ["idx", "date_col", "col_numeric_a", "col_numeric_b", "col_string_a", "col_string_b", "col_null"], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null", "alias": "dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__2cb530c665a8cf00ce1964d02e863282"}, "created_at": 1649080791.7458339, "compiled_sql": "with relation_columns as (\n\n \n select\n 1 as relation_column_idx,\n cast('IDX' as \n varchar\n) as relation_column\n union all\n \n select\n 2 as relation_column_idx,\n cast('DATE_COL' as \n varchar\n) as relation_column\n union all\n \n select\n 3 as relation_column_idx,\n cast('COL_NUMERIC_A' as \n varchar\n) as relation_column\n union all\n \n select\n 4 as relation_column_idx,\n cast('COL_NUMERIC_B' as \n varchar\n) as relation_column\n union all\n \n select\n 5 as relation_column_idx,\n cast('COL_STRING_A' as \n varchar\n) as relation_column\n union all\n \n select\n 6 as relation_column_idx,\n cast('COL_STRING_B' as \n varchar\n) as relation_column\n union all\n \n select\n 7 as relation_column_idx,\n cast('COL_NULL' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select\n 1 as input_column_idx,\n cast('IDX' as \n varchar\n) as input_column\n union all\n \n select\n 2 as input_column_idx,\n cast('DATE_COL' as \n varchar\n) as input_column\n union all\n \n select\n 3 as input_column_idx,\n cast('COL_NUMERIC_A' as \n varchar\n) as input_column\n union all\n \n select\n 4 as input_column_idx,\n cast('COL_NUMERIC_B' as \n varchar\n) as input_column\n union all\n \n select\n 5 as input_column_idx,\n cast('COL_STRING_A' as \n varchar\n) as input_column\n union all\n \n select\n 6 as input_column_idx,\n cast('COL_STRING_B' as \n varchar\n) as input_column\n union all\n \n select\n 7 as input_column_idx,\n cast('COL_NULL' as \n varchar\n) as input_column\n \n \n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb": {"raw_sql": "{{ dbt_expectations.test_expect_table_column_count_to_equal_other_table(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32\") }}", "test_metadata": {"name": "expect_table_column_count_to_equal_other_table", "kwargs": {"compare_model": "ref(\"data_test\")", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_", "alias": "dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__429bfd357eb524914b55a0149c3b4e32"}, "created_at": 1649080791.753284, "compiled_sql": "with test_data as (\n\n select\n 7 as number_columns,\n 7 as compare_number_columns\n\n)\nselect *\nfrom test_data\nwhere\n number_columns != compare_number_columns", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480": {"raw_sql": "{{ dbt_expectations.test_expect_table_columns_to_not_contain_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93\") }}", "test_metadata": {"name": "expect_table_columns_to_not_contain_set", "kwargs": {"column_list": ["col_numeric_c", "col_string_d"], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_columns_to_not_contain_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d", "alias": "dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__fe8569d774ce6161e70a64ebec37bf93"}, "created_at": 1649080791.759367, "compiled_sql": "with relation_columns as (\n\n \n select cast('IDX' as \n varchar\n) as relation_column\n union all\n \n select cast('DATE_COL' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NUMERIC_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_A' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_STRING_B' as \n varchar\n) as relation_column\n union all\n \n select cast('COL_NULL' as \n varchar\n) as relation_column\n \n \n ),\n input_columns as (\n\n \n select cast('COL_NUMERIC_C' as \n varchar\n) as input_column\n union all\n \n select cast('COL_STRING_D' as \n varchar\n) as input_column\n \n \n )\n -- catch any column in input list that is in the list of table columns\n select *\n from\n input_columns i\n inner join\n relation_columns r on r.relation_column = i.input_column", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af": {"raw_sql": "{{ dbt_expectations.test_expression_is_true(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9\") }}", "test_metadata": {"name": "expression_is_true", "kwargs": {"expression": "(col_numeric_a + col_numeric_b = 1)", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expression_is_true", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_", "alias": "dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expression_is_2b3df2f34bfbadac00cbf5c1d2fc43b9"}, "created_at": 1649080791.768694, "compiled_sql": "\n\n \n with grouped_expression as (\n select\n \n \n \n (col_numeric_a + col_numeric_b = 1) as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb": {"raw_sql": "{{ dbt_expectations.test_equal_expression(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906\") }}", "test_metadata": {"name": "equal_expression", "kwargs": {"expression": "sum(col_numeric_a)", "compare_model": "ref(\"data_test\")", "group_by": ["idx"], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx", "alias": "dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_equal_express_0c869ab94c242f93ca627a01f2bf5906"}, "created_at": 1649080791.7744179, "compiled_sql": "\n with a as (\n \n select\n \n idx as col_1,\n \n sum(col_numeric_a) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n group by\n 1\n \n \n\n ),\n b as (\n \n select\n \n idx as col_1,\n \n sum(col_numeric_a) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n group by\n 1\n \n \n\n ),\n final as (\n\n select\n coalesce(a.col_1, b.col_1) as col_1,\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a\n full outer join\n b on\n a.col_1 = b.col_1 \n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f": {"raw_sql": "{{ dbt_expectations.test_equal_expression(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0\") }}", "test_metadata": {"name": "equal_expression", "kwargs": {"expression": "sum(col_numeric_a)", "compare_expression": "sum(col_numeric_a * .5)", "compare_model": "ref(\"data_test\")", "group_by": ["idx"], "tolerance_percent": 0.5, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5", "alias": "dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_equal_express_64b620dd67b7636a374cb58a3d18d1d0"}, "created_at": 1649080791.7800431, "compiled_sql": "\n with a as (\n \n select\n \n idx as col_1,\n \n sum(col_numeric_a) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n group by\n 1\n \n \n\n ),\n b as (\n \n select\n \n idx as col_1,\n \n sum(col_numeric_a * .5) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n group by\n 1\n \n \n\n ),\n final as (\n\n select\n coalesce(a.col_1, b.col_1) as col_1,\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a\n full outer join\n b on\n a.col_1 = b.col_1 \n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference_percent > 0.5\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790": {"raw_sql": "{{ dbt_expectations.test_expect_column_pair_values_to_be_in_set(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871\") }}", "test_metadata": {"name": "expect_column_pair_values_to_be_in_set", "kwargs": {"column_A": "col_numeric_a", "column_B": "col_numeric_b", "value_pairs_set": [[0, 1], [1, 0], [0.5, 0.5], [0.5, 0.5]], "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_", "alias": "dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_aff59f660298ae56e9f051d2aa960871"}, "created_at": 1649080791.7864819, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\n(col_numeric_a = 0 and col_numeric_b = 1) or \n\n\n(col_numeric_a = 1 and col_numeric_b = 0) or \n\n\n(col_numeric_a = 0.5 and col_numeric_b = 0.5) or \n\n\n(col_numeric_a = 0.5 and col_numeric_b = 0.5)\n\n\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac": {"raw_sql": "{{ dbt_expectations.test_equal_expression(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd\") }}", "test_metadata": {"name": "equal_expression", "kwargs": {"expression": "sum(col_numeric_a)", "compare_model": "ref(\"data_test\")", "compare_expression": "sum(col_numeric_b)", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_", "alias": "dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_equal_express_2d20fc726cbd67b460e63b044f84b7cd"}, "created_at": 1649080791.795118, "compiled_sql": "\n with a as (\n \n select\n \n sum(col_numeric_a) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n\n ),\n b as (\n \n select\n \n sum(col_numeric_b) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac": {"raw_sql": "{{ dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72\") }}", "test_metadata": {"name": "expect_column_pair_values_A_to_be_greater_than_B", "kwargs": {"column_A": "col_numeric_a+10", "column_B": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a", "alias": "dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_59560feb2fa77921ad441cae8ab09d72"}, "created_at": 1649080791.801392, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n col_numeric_a+10 > col_numeric_a as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4": {"raw_sql": "{{ dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3\") }}", "test_metadata": {"name": "expect_column_pair_values_A_to_be_greater_than_B", "kwargs": {"column_A": "col_numeric_a", "column_B": "col_numeric_a", "or_equal": true, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True", "alias": "dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_44a9366fe77aed6550fcacfb7cc320c3"}, "created_at": 1649080791.808118, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n col_numeric_a >= col_numeric_a as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0": {"raw_sql": "{{ dbt_expectations.test_expect_column_pair_values_to_be_equal(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d\") }}", "test_metadata": {"name": "expect_column_pair_values_to_be_equal", "kwargs": {"column_A": "col_numeric_a", "column_B": "col_numeric_a", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_pair_values_to_be_equal", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a", "alias": "dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_f00413c4b5b21f6942adc59a9d99b53d"}, "created_at": 1649080791.8131142, "compiled_sql": "\n\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n col_numeric_a = col_numeric_a as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284": {"raw_sql": "{{ dbt_expectations.test_expect_select_column_values_to_be_unique_within_record(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84\") }}", "test_metadata": {"name": "expect_select_column_values_to_be_unique_within_record", "kwargs": {"column_list": ["col_string_a", "col_string_b"], "ignore_row_if": "any_value_is_missing", "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing", "alias": "dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_select_37680c45720b064bdf2b91b72f28ef84"}, "created_at": 1649080791.820514, "compiled_sql": "\n\n\n\n\nwith column_values as (\n\n select\n row_number() over(order by 1) as row_index,\n col_string_a,col_string_b\n from postgres.dbt_expectations_integration_tests.data_test\n where 1=1\n \n \n and\n (\n col_string_a is not null or col_string_b is not null\n )\n \n\n),\nunpivot_columns as (\n\n \n select row_index, 'col_string_a' as column_name, col_string_a as column_value from column_values\n union all\n \n select row_index, 'col_string_b' as column_name, col_string_b as column_value from column_values\n \n \n),\nvalidation_errors as (\n\n select\n row_index,\n count(distinct column_value) as column_values\n from unpivot_columns\n group by 1\n having count(distinct column_value) < 2\n\n)\nselect * from validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071": {"raw_sql": "{{ dbt_expectations.test_expect_multicolumn_sum_to_equal(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416\") }}", "test_metadata": {"name": "expect_multicolumn_sum_to_equal", "kwargs": {"column_list": ["col_numeric_a", "col_numeric_b"], "sum_total": 4, "model": "{{ get_where_subquery(ref('data_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_multicolumn_sum_to_equal", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4", "alias": "dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_multic_7041b60d4b075d2c2aa482c6052d6416"}, "created_at": 1649080791.834975, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\nsum(col_numeric_a) + \n\nsum(col_numeric_b)\n = 4\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.data_test\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2\") }}", "test_metadata": {"name": "expect_table_row_count_to_equal_other_table_times_factor", "kwargs": {"compare_model": "ref(\"data_test\")", "factor": 2, "model": "{{ get_where_subquery(ref('data_test_factored')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test_factored"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2", "alias": "dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["data_test"], ["data_test_factored"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__c7e6600647351029a4492709e1d58dd2"}, "created_at": 1649080791.8427362, "compiled_sql": "\n with a as (\n \n select\n \n count(*) as expression\n from\n postgres.dbt_expectations_integration_tests.data_test_factored\n \n\n ),\n b as (\n \n select\n \n count(*) * 2 as expression\n from\n postgres.dbt_expectations_integration_tests.data_test\n \n\n ),\n final as (\n\n select\n \n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n \n a cross join b\n \n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n \n expression_difference > 0.0\n ", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.data_test_factored"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"min_value": 10, "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10", "alias": "dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__064ba18602ba465cfaf04e075e758718"}, "created_at": 1649080791.8499331, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n( 1=1 and count(*) >= 10\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"min_value": 10, "group_by": ["date_day"], "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10", "alias": "dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__f4326907fdb0061ad0c20f6c75a5be5d"}, "created_at": 1649080791.854389, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n date_day as col_1,\n \n \n \n \n( 1=1 and count(*) >= 10\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n group by\n date_day\n \n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b": {"raw_sql": "{{ dbt_expectations.test_expect_table_row_count_to_be_between(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1\") }}", "test_metadata": {"name": "expect_table_row_count_to_be_between", "kwargs": {"max_value": 10000, "group_by": ["group_id"], "strictly": true, "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True", "alias": "dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_table__5f321fff5185e007b74c07f5d2bc74b1"}, "created_at": 1649080791.859491, "compiled_sql": "\n\n\n\n with grouped_expression as (\n select\n \n group_id as col_1,\n \n \n \n \n( 1=1 and count(*) < 10000\n)\n as expression\n\n\n from postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n group by\n group_id\n \n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781": {"raw_sql": "{{ dbt_expectations.test_expect_grouped_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485\") }}", "test_metadata": {"name": "expect_grouped_row_values_to_have_recent_data", "kwargs": {"group_by": ["group_id"], "timestamp_column": "date_day", "datepart": "day", "interval": 1, "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day", "alias": "dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_groupe_03905c2833f0ca1b26dbf87596f1c485"}, "created_at": 1649080791.866187, "compiled_sql": "\n\n \nwith latest_grouped_timestamps as (\n\n select\n group_id,\n max(1) as join_key,\n max(date_day) as latest_timestamp_column\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n\n group by 1\n\n),\ntotal_row_counts as (\n\n select\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n latest_timestamp_column < \n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8": {"raw_sql": "{{ dbt_expectations.test_expect_grouped_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d\") }}", "test_metadata": {"name": "expect_grouped_row_values_to_have_recent_data", "kwargs": {"group_by": ["group_id", "row_value"], "timestamp_column": "date_day", "datepart": "day", "interval": 1, "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day", "alias": "dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_groupe_f632c52585d5c1752d72ba5b59c0fd8d"}, "created_at": 1649080791.8796391, "compiled_sql": "\n\n \nwith latest_grouped_timestamps as (\n\n select\n group_id,\n row_value,\n max(1) as join_key,\n max(date_day) as latest_timestamp_column\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n\n group by 1,2\n\n),\ntotal_row_counts as (\n\n select\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n latest_timestamp_column < \n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8": {"raw_sql": "{{ dbt_expectations.test_expect_grouped_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669\") }}", "test_metadata": {"name": "expect_grouped_row_values_to_have_recent_data", "kwargs": {"group_by": ["group_id"], "timestamp_column": "date_day", "datepart": "day", "interval": 1, "row_condition": "group_id = 4", "model": "{{ get_where_subquery(ref('timeseries_data_grouped')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day", "alias": "dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["timeseries_data_grouped"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_groupe_66f5377f4dbc0f8eb99e60e450aaa669"}, "created_at": 1649080791.886432, "compiled_sql": "\n\n \nwith latest_grouped_timestamps as (\n\n select\n group_id,\n max(1) as join_key,\n max(date_day) as latest_timestamp_column\n from\n postgres.dbt_expectations_integration_tests.timeseries_data_grouped\n \n where group_id = 4\n \n\n group by 1\n\n),\ntotal_row_counts as (\n\n select\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n latest_timestamp_column < \n\n cast(\n current_timestamp::timestamp without time zone\n at time zone 'UTC' at time zone 'America/Los_Angeles' as timestamp without time zone) + ((interval '1 day') * (-1))\n\n\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.timeseries_data_grouped"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_increasing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae\") }}", "test_metadata": {"name": "expect_column_values_to_be_increasing", "kwargs": {"group_by": ["idx"], "strictly": true, "sort_column": "date_col", "column_name": "rolling_sum_increasing", "model": "{{ get_where_subquery(ref('window_function_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_increasing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.window_function_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True", "alias": "dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["window_function_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_6f21fa397105f33c57ef84f0ef082dae"}, "created_at": 1649080791.892419, "compiled_sql": "with all_values as (\n\n select\n date_col as sort_column,idx,\n rolling_sum_increasing as value_field\n from postgres.dbt_expectations_integration_tests.window_function_test\n \n\n),\nadd_lag_values as (\n\n select\n sort_column,idx,\n value_field,\n lag(value_field) over(partition by idx order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field > value_field_lag)\n\n)\nselect *\nfrom validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "rolling_sum_increasing", "file_key_name": "models.window_function_test"}, "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_be_decreasing(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a\") }}", "test_metadata": {"name": "expect_column_values_to_be_decreasing", "kwargs": {"group_by": ["idx"], "strictly": true, "sort_column": "date_col", "column_name": "rolling_sum_decreasing", "model": "{{ get_where_subquery(ref('window_function_test')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_decreasing", "macro.dbt.get_where_subquery"], "nodes": ["model.dbt_expectations_integration_tests.window_function_test"]}, "config": {"enabled": true, "alias": "dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "dbt_test__audit", "fqn": ["dbt_expectations_integration_tests", "schema_tests", "dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True"], "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a.sql", "original_file_path": "models/schema_tests/schema.yml", "name": "dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True", "alias": "dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["window_function_test"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/dbt_expectations_integration_tests/models/schema_tests/schema.yml/dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_expect_column_0181315364cadff36f627b8e7d628d6a"}, "created_at": 1649080791.897102, "compiled_sql": "\nwith all_values as (\n\n select\n date_col as sort_column,idx,\n rolling_sum_decreasing as value_field\n from postgres.dbt_expectations_integration_tests.window_function_test\n \n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(partition by idx order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field < value_field_lag)\n\n)\nselect *\nfrom validation_errors\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "rolling_sum_decreasing", "file_key_name": "models.window_function_test"}}, "sources": {}, "macros": {"macro.dbt_expectations_integration_tests.generate_schema_name": {"unique_id": "macro.dbt_expectations_integration_tests.generate_schema_name", "package_name": "dbt_expectations_integration_tests", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests", "path": "macros/get_custom_schema.sql", "original_file_path": "macros/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 {{ 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": 1649080789.626626}, "macro.dbt_postgres.postgres__get_catalog": {"unique_id": "macro.dbt_postgres.postgres__get_catalog", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "postgres__get_catalog", "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n\n {%- call statement('catalog', fetch_result=True) -%}\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n\n where (\n {%- for schema in schemas -%}\n upper(sch.nspname) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence in ('p', 'u') -- [p]ermanent table or [u]nlogged table. Exclude [t]emporary tables\n and tbl.relkind in ('r', 'v', 'f', 'p') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table, [m]aterialized view\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6312692}, "macro.dbt_postgres.postgres_get_relations": {"unique_id": "macro.dbt_postgres.postgres_get_relations", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "name": "postgres_get_relations", "macro_sql": "{% macro postgres_get_relations () -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.633055}, "macro.dbt_postgres.postgres__create_table_as": {"unique_id": "macro.dbt_postgres.postgres__create_table_as", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_table_as", "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.644402}, "macro.dbt_postgres.postgres__get_create_index_sql": {"unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_create_index_sql", "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.645737}, "macro.dbt_postgres.postgres__create_schema": {"unique_id": "macro.dbt_postgres.postgres__create_schema", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_schema", "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.64657}, "macro.dbt_postgres.postgres__drop_schema": {"unique_id": "macro.dbt_postgres.postgres__drop_schema", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__drop_schema", "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.647396}, "macro.dbt_postgres.postgres__get_columns_in_relation": {"unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_columns_in_relation", "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.sql_convert_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.648929}, "macro.dbt_postgres.postgres__list_relations_without_caching": {"unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_relations_without_caching", "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.650013}, "macro.dbt_postgres.postgres__information_schema_name": {"unique_id": "macro.dbt_postgres.postgres__information_schema_name", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__information_schema_name", "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6504729}, "macro.dbt_postgres.postgres__list_schemas": {"unique_id": "macro.dbt_postgres.postgres__list_schemas", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_schemas", "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6513999}, "macro.dbt_postgres.postgres__check_schema_exists": {"unique_id": "macro.dbt_postgres.postgres__check_schema_exists", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__check_schema_exists", "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.652425}, "macro.dbt_postgres.postgres__current_timestamp": {"unique_id": "macro.dbt_postgres.postgres__current_timestamp", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__current_timestamp", "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.652632}, "macro.dbt_postgres.postgres__snapshot_string_as_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_string_as_time", "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.653101}, "macro.dbt_postgres.postgres__snapshot_get_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_get_time", "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.653375}, "macro.dbt_postgres.postgres__make_temp_relation": {"unique_id": "macro.dbt_postgres.postgres__make_temp_relation", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__make_temp_relation", "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix_length = suffix|length + dtstring|length %}\n {% set relation_max_name_length = 63 %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Temp relation suffix is too long (' ~ suffix|length ~ ' characters). Maximum length is ' ~ (relation_max_name_length - dtstring|length) ~ ' characters.') %}\n {% endif %}\n {% set tmp_identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix ~ dtstring %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6555789}, "macro.dbt_postgres.postgres_escape_comment": {"unique_id": "macro.dbt_postgres.postgres_escape_comment", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres_escape_comment", "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.656699}, "macro.dbt_postgres.postgres__alter_relation_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_relation_comment", "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.657287}, "macro.dbt_postgres.postgres__alter_column_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_column_comment", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_column_comment", "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in column_dict if (column_name in existing_columns) %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.658842}, "macro.dbt_postgres.postgres__snapshot_merge_sql": {"unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", "package_name": "dbt_postgres", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/materializations/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot_merge.sql", "name": "postgres__snapshot_merge_sql", "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6608}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6636522}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6641788}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.664583}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6649652}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.665375}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.666547}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6673589}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.668295}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.669504}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.670196}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.677689}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.678129}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.678714}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.679086}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.679341}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.681209}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6816351}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6822221}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.684891}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.689898}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.6969879}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.697765}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.698215}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.698466}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.699014}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.701278}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.701785}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.702464}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.703605}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7172632}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.721737}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.72279}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.723488}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.724397}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.725248}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.726984}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7284968}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7298508}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7355258}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7380438}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.738553}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.739681}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.740337}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.741718}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.743235}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7544131}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.763956}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7678}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.770487}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.772089}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.779983}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.781079}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.781495}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.782466}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.783395}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7906392}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.791709}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.792214}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.795043}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.795938}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.796302}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.7967072}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.797285}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.803883}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8116639}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.813652}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.814163}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.815226}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8155441}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.816266}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.816725}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.816986}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8182158}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.818957}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.821915}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8229089}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.823413}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8246558}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.825352}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.825983}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.827543}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.828172}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8290591}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8296099}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.830299}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8316312}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.834542}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8357959}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.836436}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.839699}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8423948}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8444312}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.844936}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.845857}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.846263}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.846616}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8470201}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.848072}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.848375}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8487291}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.850212}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.853793}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.854559}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.855108}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.855843}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.856553}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.85692}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.857368}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.858239}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.858786}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.860317}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8608918}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.861344}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.862449}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.862776}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.863283}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.864218}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.86563}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.866001}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.867062}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.867556}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8681548}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.869208}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8718889}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8724558}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.872865}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8732119}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.873609}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.874149}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.874596}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.875675}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.87614}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8764958}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.879901}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.880248}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.880928}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.881335}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8820748}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.882642}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.884567}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.88534}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.887093}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.888295}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.888813}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.889456}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.890066}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.890771}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.890959}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.891127}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8919868}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.892361}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.893065}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.893455}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.895201}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.895373}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.89554}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.895704}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8958662}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.postgres__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.896221}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.89639}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8965561}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.89672}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8970711}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.897245}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.897415}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.897774}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8979468}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.898114}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.8984761}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.898649}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.898815}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.899423}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.899599}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.899765}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.901484}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.902271}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9025111}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.902743}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.903954}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.904325}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.904691}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.90505}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.905473}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.906162}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9063308}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.906495}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9073331}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9076428}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.907948}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.908258}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.909481}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.909787}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9101381}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9106581}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.915393}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.915762}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) %}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.916119}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.92096}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) %}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.921441}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.92242}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9227352}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.923033}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9233222}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.924103}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.924416}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.924712}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.92551}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.925827}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9261189}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.927743}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.927988}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.928231}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.929034}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.929389}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.929638}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.930547}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9308548}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9311638}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.931864}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.932102}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9339368}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.934201}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.93437}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9345338}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.934887}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9351869}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.935511}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9357572}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.936047}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.938622}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.939638}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.940755}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.941351}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.942334}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.942572}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.942802}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.943033}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.944468}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.945054}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.945385}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.946253}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.946653}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9476721}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.948046}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n 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": 1649080789.948441}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9492931}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) %}\n date_trunc('{{datepart}}', {{date}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.949599}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) %}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.949899}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.952543}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.962634}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.963866}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.964559}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.965677}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.977864}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.978814}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9798558}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.980948}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.982516}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9833548}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.984916}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.985653}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.986016}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9867678}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.9871948}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.987904}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.988281}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080789.98944}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.9905732}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.9910452}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.99198}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.99263}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.994164}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.995162}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.996133}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.996854}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.9976692}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.998056}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080789.9993799}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.000502}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.002402}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0032482}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.004277}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.004648}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0054789}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.005867}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0071821}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.00859}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.009769}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.01051}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.011987}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0129468}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.013936}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0150568}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.0165582}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.018497}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.019538}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.019905}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.021342}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.023251}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.02876}, "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/claus/dev/calogica/dbt-expectations/integration_tests/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": 1649080790.032116}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.033553}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0356019}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.036136}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.036939}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.037767}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.038532}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.039986}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.041856}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.043482}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0447848}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.045207}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0463622}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.047811}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.049663}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.051418}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0520508}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0537689}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set 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 }} {%- if prefix!='' or suffix!='' -%} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\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": 1649080790.0564349}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.059691}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.065326}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\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": 1649080790.0701141}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\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 {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\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": 1649080790.076292}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.077235}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0779111}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.079215}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.081242}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.082196}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.082826}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.08368}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0851579}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.088245}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.088897}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n 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": 1649080790.090427}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.091601}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\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": 1649080790.09357}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\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": 1649080790.09703}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.0992079}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.101942}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1030688}, "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/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.104554}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.105474}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1057658}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1059499}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.108027}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.10864}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.11004}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.112279}, "macro.dbt_date.get_date_dimension": {"unique_id": "macro.dbt_date.get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.126173}, "macro.dbt_date.default__get_date_dimension": {"unique_id": "macro.dbt_date.default__get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n select\n cast(d.date_day as date) as date_day,\n cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n from\n \tbase_dates d\n\n)\nselect\n d.date_day,\n {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n d.prior_year_date_day as prior_year_date_day,\n d.prior_year_over_year_date_day,\n {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year,\n {{ dbt_date.month_name('d.date_day', short=false) }} as month_name,\n {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short,\n\n cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year,\n cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number,\n cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt_utils.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt_utils.type_int", "macro.dbt_date.month_name", "macro.dbt_utils.date_trunc", "macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1316748}, "macro.dbt_date.postgres__get_date_dimension": {"unique_id": "macro.dbt_date.postgres__get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n select\n cast(d.date_day as date) as date_day,\n cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n from\n \tbase_dates d\n\n)\nselect\n d.date_day,\n {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n d.prior_year_date_day as prior_year_date_day,\n d.prior_year_over_year_date_day,\n {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year,\n {{ dbt_date.month_name('d.date_day', short=false) }} as month_name,\n {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short,\n\n cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year,\n cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n {# dbt_utils.last_day does not support quarter because postgresql does not support quarter interval. #}\n cast({{dbt_utils.dateadd('day', '-1', dbt_utils.dateadd('month', '3', dbt_utils.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number,\n cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt_utils.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt_utils.type_int", "macro.dbt_date.month_name", "macro.dbt_utils.date_trunc", "macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1376598}, "macro.dbt_date.get_base_dates": {"unique_id": "macro.dbt_date.get_base_dates", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.139681}, "macro.dbt_date.default__get_base_dates": {"unique_id": "macro.dbt_date.default__get_base_dates", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt_utils.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt_utils.type_timestamp() ~ \")\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n {{ dbt_utils.date_spine(\n datepart=datepart,\n start_date=start_date,\n end_date=end_date,\n )\n }}\n\n)\nselect\n cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }}\nfrom\n date_spine d\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_utils.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1414242}, "macro.dbt_date.bigquery__get_base_dates": {"unique_id": "macro.dbt_date.bigquery__get_base_dates", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as date )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as date )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n {{ dbt_utils.date_spine(\n datepart=datepart,\n start_date=start_date,\n end_date=end_date,\n )\n }}\n\n)\nselect\n cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }}\nfrom\n date_spine d\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_utils.date_spine", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.142914}, "macro.dbt_date.get_fiscal_year_dates": {"unique_id": "macro.dbt_date.get_fiscal_year_dates", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "name": "get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1461911}, "macro.dbt_date.default__get_fiscal_year_dates": {"unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "name": "default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith date_dimension as (\n select * from {{ dates }}\n),\nyear_month_end as (\n\n select\n d.year_number - {{ shift_year }} as fiscal_year_number,\n d.month_end_date\n from\n date_dimension d\n where\n d.month_of_year = {{ year_end_month }}\n group by 1,2\n\n),\nweeks as (\n\n select\n d.year_number,\n d.month_of_year,\n d.date_day as week_start_date,\n cast({{ dbt_utils.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n from\n date_dimension d\n where\n d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n select\n d.year_number - {{ shift_year }} as fiscal_year_number,\n d.week_end_date\n from\n weeks d\n where\n d.month_of_year = {{ year_end_month }}\n group by\n 1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n select\n d.fiscal_year_number,\n d.week_end_date,\n m.month_end_date,\n rank() over\n (partition by d.fiscal_year_number\n order by\n abs({{ dbt_utils.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n ) as closest_to_month_end\n from\n year_week_ends d\n join\n year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n select\n w.fiscal_year_number,\n cast(\n {{ dbt_utils.dateadd('day', 1,\n 'lag(w.week_end_date) over(order by w.week_end_date)') }}\n as date) as fiscal_year_start_date,\n w.week_end_date as fiscal_year_end_date\n from\n weeks_at_month_end w\n where\n w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n select\n d.date_day,\n m.fiscal_year_number,\n m.fiscal_year_start_date,\n m.fiscal_year_end_date,\n w.week_start_date,\n w.week_end_date,\n -- we reset the weeks of the year starting with the merch year start date\n dense_rank()\n over(\n partition by m.fiscal_year_number\n order by w.week_start_date\n ) as fiscal_week_of_year\n from\n date_dimension d\n join\n fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n join\n weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.147406}, "macro.dbt_date.get_fiscal_periods": {"unique_id": "macro.dbt_date.get_fiscal_periods", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "name": "get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{# \nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n select\n f.*,\n -- We count the weeks in a 13 week period\n -- and separate the 4-5-4 week sequences\n mod(cast(\n (f.fiscal_week_of_year-1) as {{ dbt_utils.type_int() }}\n ), 13) as w13_number,\n -- Chop weeks into 13 week merch quarters\n cast(\n least(\n floor((f.fiscal_week_of_year-1)/13.0)\n , 3)\n as {{ dbt_utils.type_int() }}) as quarter_number\n from\n fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n select\n f.date_day,\n f.fiscal_year_number,\n f.week_start_date,\n f.week_end_date,\n f.fiscal_week_of_year,\n case \n -- we move week 53 into the 3rd period of the quarter\n when f.fiscal_week_of_year = 53 then 3\n when f.w13_number between 0 and 3 then 1\n when f.w13_number between 4 and 8 then 2\n when f.w13_number between 9 and 12 then 3\n end as period_of_quarter,\n f.quarter_number\n from\n fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n select\n f.*,\n cast((\n (f.quarter_number * 3) + f.period_of_quarter\n ) as {{ dbt_utils.type_int() }}) as fiscal_period_number\n from\n fscl_periods f\n\n)\nselect\n date_day,\n fiscal_year_number,\n week_start_date,\n week_end_date,\n fiscal_week_of_year, \n dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n fiscal_period_number,\n quarter_number+1 as fiscal_quarter_number,\n period_of_quarter as fiscal_period_of_quarter\nfrom \n fscl_periods_quarters \norder by 1,2\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.149163}, "macro.dbt_date.tomorrow": {"unique_id": "macro.dbt_date.tomorrow", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "name": "tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.149816}, "macro.dbt_date.next_week": {"unique_id": "macro.dbt_date.next_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "name": "next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.150385}, "macro.dbt_date.next_month_name": {"unique_id": "macro.dbt_date.next_month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "name": "next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(1, tz), short=short) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.151115}, "macro.dbt_date.next_month": {"unique_id": "macro.dbt_date.next_month", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "name": "next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1522539}, "macro.dbt_date.day_name": {"unique_id": "macro.dbt_date.day_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__day_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.153731}, "macro.dbt_date.default__day_name": {"unique_id": "macro.dbt_date.default__day_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.154187}, "macro.dbt_date.snowflake__day_name": {"unique_id": "macro.dbt_date.snowflake__day_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n {%- if short -%}\n dayname({{ date }})\n {%- else -%}\n -- long version not implemented on Snowflake so we're doing it manually :/\n case dayname({{ date }})\n when 'Mon' then 'Monday'\n when 'Tue' then 'Tuesday'\n when 'Wed' then 'Wednesday'\n when 'Thu' then 'Thursday'\n when 'Fri' then 'Friday'\n when 'Sat' then 'Saturday'\n when 'Sun' then 'Sunday'\n end\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.154641}, "macro.dbt_date.bigquery__day_name": {"unique_id": "macro.dbt_date.bigquery__day_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.155091}, "macro.dbt_date.postgres__day_name": {"unique_id": "macro.dbt_date.postgres__day_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1555479}, "macro.dbt_date.to_unixtimestamp": {"unique_id": "macro.dbt_date.to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.156339}, "macro.dbt_date.default__to_unixtimestamp": {"unique_id": "macro.dbt_date.default__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.156655}, "macro.dbt_date.snowflake__to_unixtimestamp": {"unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1569679}, "macro.dbt_date.bigquery__to_unixtimestamp": {"unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n unix_seconds({{ timestamp }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.157208}, "macro.dbt_date.n_days_away": {"unique_id": "macro.dbt_date.n_days_away", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "name": "n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.158092}, "macro.dbt_date.week_start": {"unique_id": "macro.dbt_date.week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.postgres__week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.159233}, "macro.dbt_date.default__week_start": {"unique_id": "macro.dbt_date.default__week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt_utils.date_trunc('week', date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.159567}, "macro.dbt_date.snowflake__week_start": {"unique_id": "macro.dbt_date.snowflake__week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n {#\n Get the day of week offset: e.g. if the date is a Sunday,\n dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n #}\n {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n cast({{ dbt_utils.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1602108}, "macro.dbt_date.postgres__week_start": {"unique_id": "macro.dbt_date.postgres__week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt_utils.dateadd('day', -1, dbt_utils.date_trunc('week', dbt_utils.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "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": 1649080790.160885}, "macro.dbt_date.iso_week_start": {"unique_id": "macro.dbt_date.iso_week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.postgres__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.162289}, "macro.dbt_date._iso_week_start": {"unique_id": "macro.dbt_date._iso_week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "_iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt_utils.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.162637}, "macro.dbt_date.default__iso_week_start": {"unique_id": "macro.dbt_date.default__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.162996}, "macro.dbt_date.snowflake__iso_week_start": {"unique_id": "macro.dbt_date.snowflake__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.163307}, "macro.dbt_date.postgres__iso_week_start": {"unique_id": "macro.dbt_date.postgres__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1636171}, "macro.dbt_date.n_days_ago": {"unique_id": "macro.dbt_date.n_days_ago", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "name": "n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt_utils.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.164671}, "macro.dbt_date.last_week": {"unique_id": "macro.dbt_date.last_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "name": "last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.165246}, "macro.dbt_date.now": {"unique_id": "macro.dbt_date.now", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "name": "now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt_utils.current_timestamp(), tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.165855}, "macro.dbt_date.periods_since": {"unique_id": "macro.dbt_date.periods_since", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "name": "periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt_utils.datediff(date_col, dbt_date.now(tz), period_name) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.166591}, "macro.dbt_date.today": {"unique_id": "macro.dbt_date.today", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "name": "today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.167148}, "macro.dbt_date.last_month": {"unique_id": "macro.dbt_date.last_month", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "name": "last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1677172}, "macro.dbt_date.day_of_year": {"unique_id": "macro.dbt_date.day_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1692002}, "macro.dbt_date.default__day_of_year": {"unique_id": "macro.dbt_date.default__day_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1696692}, "macro.dbt_date.postgres__day_of_year": {"unique_id": "macro.dbt_date.postgres__day_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.169985}, "macro.dbt_date.redshift__day_of_year": {"unique_id": "macro.dbt_date.redshift__day_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt_utils.type_bigint() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.170399}, "macro.dbt_date.from_unixtimestamp": {"unique_id": "macro.dbt_date.from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.172758}, "macro.dbt_date.default__from_unixtimestamp": {"unique_id": "macro.dbt_date.default__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n {%- if format != \"seconds\" -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n to_timestamp({{ epochs }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.173336}, "macro.dbt_date.postgres__from_unixtimestamp": {"unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n {%- if format != \"seconds\" -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.173911}, "macro.dbt_date.snowflake__from_unixtimestamp": {"unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n {%- if format == \"seconds\" -%}\n {%- set scale = 0 -%}\n {%- elif format == \"milliseconds\" -%}\n {%- set scale = 3 -%}\n {%- elif format == \"microseconds\" -%}\n {%- set scale = 6 -%}\n {%- else -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.174953}, "macro.dbt_date.bigquery__from_unixtimestamp": {"unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n {%- if format == \"seconds\" -%}\n timestamp_seconds({{ epochs }})\n {%- elif format == \"milliseconds\" -%}\n timestamp_millis({{ epochs }})\n {%- elif format == \"microseconds\" -%}\n timestamp_micros({{ epochs }})\n {%- else -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.175828}, "macro.dbt_date.n_months_ago": {"unique_id": "macro.dbt_date.n_months_ago", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "name": "n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('month', \n dbt_utils.dateadd('month', -1 * n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.176794}, "macro.dbt_date.date_part": {"unique_id": "macro.dbt_date.date_part", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1778471}, "macro.dbt_date.default__date_part": {"unique_id": "macro.dbt_date.default__date_part", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n date_part('{{ datepart }}', {{ date }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.17815}, "macro.dbt_date.bigquery__date_part": {"unique_id": "macro.dbt_date.bigquery__date_part", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.178456}, "macro.dbt_date.n_weeks_away": {"unique_id": "macro.dbt_date.n_weeks_away", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "name": "n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('week', \n dbt_utils.dateadd('week', n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.179379}, "macro.dbt_date.day_of_month": {"unique_id": "macro.dbt_date.day_of_month", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "name": "day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.180012}, "macro.dbt_date.redshift__day_of_month": {"unique_id": "macro.dbt_date.redshift__day_of_month", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "name": "redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt_utils.type_bigint() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.180424}, "macro.dbt_date.yesterday": {"unique_id": "macro.dbt_date.yesterday", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "name": "yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.181077}, "macro.dbt_date.day_of_week": {"unique_id": "macro.dbt_date.day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1841679}, "macro.dbt_date.default__day_of_week": {"unique_id": "macro.dbt_date.default__day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (0) to Monday (1)\n when {{ dow }} = 0 then 7\n else {{ dow }}\n end\n {%- else -%}\n {{ dow }} + 1\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.18535}, "macro.dbt_date.snowflake__day_of_week": {"unique_id": "macro.dbt_date.snowflake__day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n {%- if isoweek -%}\n {%- set dow_part = 'dayofweekiso' -%}\n {{ dbt_date.date_part(dow_part, date) }}\n {%- else -%}\n {%- set dow_part = 'dayofweek' -%}\n case\n when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n else {{ dbt_date.date_part(dow_part, date) }} + 1\n end\n {%- endif -%}\n\n\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1863801}, "macro.dbt_date.bigquery__day_of_week": {"unique_id": "macro.dbt_date.bigquery__day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (1) to Monday (2)\n when {{ dow }} = 1 then 7\n else {{ dow }} - 1\n end\n {%- else -%}\n {{ dow }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.187026}, "macro.dbt_date.postgres__day_of_week": {"unique_id": "macro.dbt_date.postgres__day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n {%- if isoweek -%}\n {%- set dow_part = 'isodow' -%}\n -- Monday(1) to Sunday (7)\n cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt_utils.type_int() }})\n {%- else -%}\n {%- set dow_part = 'dow' -%}\n -- Sunday(1) to Saturday (7)\n cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt_utils.type_int() }})\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1882172}, "macro.dbt_date.redshift__day_of_week": {"unique_id": "macro.dbt_date.redshift__day_of_week", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (0) to Monday (1)\n when {{ dow }} = 0 then 7\n else cast({{ dow }} as {{ dbt_utils.type_bigint() }})\n end\n {%- else -%}\n cast({{ dow }} + 1 as {{ dbt_utils.type_bigint() }})\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.189148}, "macro.dbt_date.iso_week_end": {"unique_id": "macro.dbt_date.iso_week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.190254}, "macro.dbt_date._iso_week_end": {"unique_id": "macro.dbt_date._iso_week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "_iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.190722}, "macro.dbt_date.default__iso_week_end": {"unique_id": "macro.dbt_date.default__iso_week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.191034}, "macro.dbt_date.snowflake__iso_week_end": {"unique_id": "macro.dbt_date.snowflake__iso_week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.191342}, "macro.dbt_date.n_weeks_ago": {"unique_id": "macro.dbt_date.n_weeks_ago", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "name": "n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('week', \n dbt_utils.dateadd('week', -1 * n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.192294}, "macro.dbt_date.month_name": {"unique_id": "macro.dbt_date.month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__month_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.193383}, "macro.dbt_date.default__month_name": {"unique_id": "macro.dbt_date.default__month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1938381}, "macro.dbt_date.bigquery__month_name": {"unique_id": "macro.dbt_date.bigquery__month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.194637}, "macro.dbt_date.snowflake__month_name": {"unique_id": "macro.dbt_date.snowflake__month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.195101}, "macro.dbt_date.postgres__month_name": {"unique_id": "macro.dbt_date.postgres__month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.195557}, "macro.dbt_date.last_month_name": {"unique_id": "macro.dbt_date.last_month_name", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "name": "last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.last_month(1, tz), short=short) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.196295}, "macro.dbt_date.week_of_year": {"unique_id": "macro.dbt_date.week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.postgres__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.1973271}, "macro.dbt_date.default__week_of_year": {"unique_id": "macro.dbt_date.default__week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.197738}, "macro.dbt_date.postgres__week_of_year": {"unique_id": "macro.dbt_date.postgres__week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.19807}, "macro.dbt_date.convert_timezone": {"unique_id": "macro.dbt_date.convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.postgres__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2004201}, "macro.dbt_date.default__convert_timezone": {"unique_id": "macro.dbt_date.default__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\n{%- if not source_tz -%}\ncast(convert_timezone('{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }})\n{%- else -%}\ncast(convert_timezone('{{ source_tz }}', '{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }})\n{%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2011662}, "macro.dbt_date.bigquery__convert_timezone": {"unique_id": "macro.dbt_date.bigquery__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.201819}, "macro.dbt_date.spark__convert_timezone": {"unique_id": "macro.dbt_date.spark__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n '{{ target_tz }}'\n )\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.202555}, "macro.dbt_date.postgres__convert_timezone": {"unique_id": "macro.dbt_date.postgres__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\n{%- if source_tz -%}\ncast({{ column }} at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }})\n{%- else -%}\ncast({{ column }} at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }})\n{%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2034}, "macro.dbt_date.redshift__convert_timezone": {"unique_id": "macro.dbt_date.redshift__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "redshift__convert_timezone", "macro_sql": "{%- macro redshift__convert_timezone(column, target_tz, source_tz) -%}\n{{ return(default__convert_timezone(column, target_tz, source_tz)) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.203809}, "macro.dbt_date.n_months_away": {"unique_id": "macro.dbt_date.n_months_away", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "name": "n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('month', \n dbt_utils.dateadd('month', n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.204797}, "macro.dbt_date.iso_week_of_year": {"unique_id": "macro.dbt_date.iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.postgres__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.206025}, "macro.dbt_date._iso_week_of_year": {"unique_id": "macro.dbt_date._iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "_iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.206458}, "macro.dbt_date.default__iso_week_of_year": {"unique_id": "macro.dbt_date.default__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.206774}, "macro.dbt_date.snowflake__iso_week_of_year": {"unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2070882}, "macro.dbt_date.postgres__iso_week_of_year": {"unique_id": "macro.dbt_date.postgres__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.207415}, "macro.dbt_date.week_end": {"unique_id": "macro.dbt_date.week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.postgres__week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2085278}, "macro.dbt_date.default__week_end": {"unique_id": "macro.dbt_date.default__week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ dbt_utils.last_day(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2088451}, "macro.dbt_date.snowflake__week_end": {"unique_id": "macro.dbt_date.snowflake__week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.209294}, "macro.dbt_date.postgres__week_end": {"unique_id": "macro.dbt_date.postgres__week_end", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.209745}, "macro.dbt_date.next_month_number": {"unique_id": "macro.dbt_date.next_month_number", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "name": "next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(1, tz)) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2104251}, "macro.dbt_date.last_month_number": {"unique_id": "macro.dbt_date.last_month_number", "package_name": "dbt_date", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "name": "last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(1, tz)) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2113569}, "macro.dbt_expectations.type_timestamp": {"unique_id": "macro.dbt_expectations.type_timestamp", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_expectations')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.postgres__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.21227}, "macro.dbt_expectations.default__type_timestamp": {"unique_id": "macro.dbt_expectations.default__type_timestamp", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/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": 1649080790.2124438}, "macro.dbt_expectations.snowflake__type_timestamp": {"unique_id": "macro.dbt_expectations.snowflake__type_timestamp", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/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": 1649080790.212615}, "macro.dbt_expectations.postgres__type_timestamp": {"unique_id": "macro.dbt_expectations.postgres__type_timestamp", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() -%}\n timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.212783}, "macro.dbt_expectations.type_datetime": {"unique_id": "macro.dbt_expectations.type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "type_datetime", "macro_sql": "{% macro type_datetime() -%}\n {{ return(adapter.dispatch('type_datetime', 'dbt_expectations')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.postgres__type_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.213135}, "macro.dbt_expectations.default__type_datetime": {"unique_id": "macro.dbt_expectations.default__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "default__type_datetime", "macro_sql": "{% macro default__type_datetime() -%}\n datetime\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.213304}, "macro.dbt_expectations.snowflake__type_datetime": {"unique_id": "macro.dbt_expectations.snowflake__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "snowflake__type_datetime", "macro_sql": "{% macro snowflake__type_datetime() -%}\n timestamp_ntz\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.21347}, "macro.dbt_expectations.postgres__type_datetime": {"unique_id": "macro.dbt_expectations.postgres__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "postgres__type_datetime", "macro_sql": "{% macro postgres__type_datetime() -%}\n timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2137332}, "macro.dbt_expectations.regexp_instr": {"unique_id": "macro.dbt_expectations.regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "regexp_instr", "macro_sql": "{% macro regexp_instr(source_value, regexp, position=1, occurrence=1) %}\n\n {{ adapter.dispatch('regexp_instr', 'dbt_expectations')(\n source_value, regexp, position, occurrence\n ) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.postgres__regexp_instr"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.215025}, "macro.dbt_expectations.default__regexp_instr": {"unique_id": "macro.dbt_expectations.default__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "default__regexp_instr", "macro_sql": "{% macro default__regexp_instr(source_value, regexp, position, occurrence) %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.215453}, "macro.dbt_expectations.redshift__regexp_instr": {"unique_id": "macro.dbt_expectations.redshift__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "redshift__regexp_instr", "macro_sql": "{% macro redshift__regexp_instr(source_value, regexp, position, occurrence) %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.215874}, "macro.dbt_expectations.postgres__regexp_instr": {"unique_id": "macro.dbt_expectations.postgres__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "postgres__regexp_instr", "macro_sql": "{% macro postgres__regexp_instr(source_value, regexp, position, occurrence) %}\narray_length((select regexp_matches({{ source_value }}, '{{ regexp }}')), 1)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.216214}, "macro.dbt_expectations.spark__regexp_instr": {"unique_id": "macro.dbt_expectations.spark__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "spark__regexp_instr", "macro_sql": "{% macro spark__regexp_instr(source_value, regexp, position, occurrence) %}\ncase when {{ source_value }} rlike '{{ regexp }}' then 1 else 0 end\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2165499}, "macro.dbt_expectations.log_natural": {"unique_id": "macro.dbt_expectations.log_natural", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "log_natural", "macro_sql": "{% macro log_natural(x) -%}\n {{ adapter.dispatch('log_natural', 'dbt_expectations') (x) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__log_natural"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2173069}, "macro.dbt_expectations.default__log_natural": {"unique_id": "macro.dbt_expectations.default__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "default__log_natural", "macro_sql": "{% macro default__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.217543}, "macro.dbt_expectations.bigquery__log_natural": {"unique_id": "macro.dbt_expectations.bigquery__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "bigquery__log_natural", "macro_sql": "{% macro bigquery__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2177742}, "macro.dbt_expectations.snowflake__log_natural": {"unique_id": "macro.dbt_expectations.snowflake__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "snowflake__log_natural", "macro_sql": "{% macro snowflake__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.218004}, "macro.dbt_expectations.rand": {"unique_id": "macro.dbt_expectations.rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "rand", "macro_sql": "{% macro rand() -%}\n {{ adapter.dispatch('rand', 'dbt_expectations') () }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.postgres__rand"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.21924}, "macro.dbt_expectations.default__rand": {"unique_id": "macro.dbt_expectations.default__rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "default__rand", "macro_sql": "{% macro default__rand() %}\n\n rand()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.219413}, "macro.dbt_expectations.bigquery__rand": {"unique_id": "macro.dbt_expectations.bigquery__rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "bigquery__rand", "macro_sql": "{% macro bigquery__rand() %}\n\n rand()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.219581}, "macro.dbt_expectations.snowflake__rand": {"unique_id": "macro.dbt_expectations.snowflake__rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "snowflake__rand", "macro_sql": "{% macro snowflake__rand(seed) %}\n\n uniform(0::float, 1::float, random())\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.219763}, "macro.dbt_expectations.postgres__rand": {"unique_id": "macro.dbt_expectations.postgres__rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "postgres__rand", "macro_sql": "{% macro postgres__rand() %}\n\n random()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.219928}, "macro.dbt_expectations.redshift__rand": {"unique_id": "macro.dbt_expectations.redshift__rand", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "redshift__rand", "macro_sql": "{% macro redshift__rand() %}\n\n random()\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.220093}, "macro.dbt_expectations.median": {"unique_id": "macro.dbt_expectations.median", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/median.sql", "original_file_path": "macros/math/median.sql", "name": "median", "macro_sql": "{% macro median(field) %}\n{{ dbt_expectations.percentile_cont(field, 0.5) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.220682}, "macro.dbt_expectations.percentile_cont": {"unique_id": "macro.dbt_expectations.percentile_cont", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "percentile_cont", "macro_sql": "{% macro percentile_cont(field, quantile, partition=None) %}\n {{ adapter.dispatch('quantile', 'dbt_expectations') (field, quantile, partition) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__quantile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2218409}, "macro.dbt_expectations.default__quantile": {"unique_id": "macro.dbt_expectations.default__quantile", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "default__quantile", "macro_sql": "{% macro default__quantile(field, quantile, partition) -%}\n percentile_cont({{ quantile }}) within group (order by {{ field }})\n {%- if partition %}over(partition by {{ partition }}){% endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.222301}, "macro.dbt_expectations.bigquery__quantile": {"unique_id": "macro.dbt_expectations.bigquery__quantile", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "bigquery__quantile", "macro_sql": "{% macro bigquery__quantile(field, quantile, partition) %}\n percentile_cont({{ field }}, {{ quantile }})\n over({%- if partition %}partition by {{ partition }}{% endif -%})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.223041}, "macro.dbt_expectations.test_expression_between": {"unique_id": "macro.dbt_expectations.test_expression_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "name": "test_expression_between", "macro_sql": "{% test expression_between(model,\n expression,\n min_value=None,\n max_value=None,\n group_by_columns=None,\n row_condition=None,\n strictly=False\n ) %}\n\n {{ dbt_expectations.expression_between(model, expression, min_value, max_value, group_by_columns, row_condition, strictly) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2252412}, "macro.dbt_expectations.expression_between": {"unique_id": "macro.dbt_expectations.expression_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "name": "expression_between", "macro_sql": "{% macro expression_between(model,\n expression,\n min_value,\n max_value,\n group_by_columns,\n row_condition,\n strictly\n ) %}\n\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n\n{%- set strict_operator = \"\" if strictly else \"=\" -%}\n\n{% set expression_min_max %}\n( 1=1\n{%- if min_value is not none %} and {{ expression | trim }} >{{ strict_operator }} {{ min_value }}{% endif %}\n{%- if max_value is not none %} and {{ expression | trim }} <{{ strict_operator }} {{ max_value }}{% endif %}\n)\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression_min_max,\n group_by_columns=group_by_columns,\n row_condition=row_condition)\n }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.226835}, "macro.dbt_expectations.test_expression_is_true": {"unique_id": "macro.dbt_expectations.test_expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n\n {{ dbt_expectations.expression_is_true(model, expression, test_condition, group_by_columns, row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.228961}, "macro.dbt_expectations.expression_is_true": {"unique_id": "macro.dbt_expectations.expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "expression_is_true", "macro_sql": "{% macro expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n {{ adapter.dispatch('expression_is_true', 'dbt_expectations') (model, expression, test_condition, group_by_columns, row_condition) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2295969}, "macro.dbt_expectations.default__expression_is_true": {"unique_id": "macro.dbt_expectations.default__expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "default__expression_is_true", "macro_sql": "{% macro default__expression_is_true(model, expression, test_condition, group_by_columns, row_condition) -%}\nwith grouped_expression as (\n select\n {% if group_by_columns %}\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ dbt_expectations.truth_expression(expression) }}\n from {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by_columns %}\n group by\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression {{ test_condition }})\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.230939}, "macro.dbt_expectations.get_select": {"unique_id": "macro.dbt_expectations.get_select", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "get_select", "macro_sql": "{% macro get_select(model, expression, row_condition, group_by) -%}\n {{ adapter.dispatch('get_select', 'dbt_expectations') (model, expression, row_condition, group_by) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__get_select"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.239989}, "macro.dbt_expectations.default__get_select": {"unique_id": "macro.dbt_expectations.default__get_select", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "default__get_select", "macro_sql": "\n\n{%- macro default__get_select(model, expression, row_condition, group_by) %}\n select\n {% if group_by %}\n {% for g in group_by -%}\n {{ g }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ expression }} as expression\n from\n {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by %}\n group by\n {% for g in group_by -%}\n {{ loop.index }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n{% endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2412229}, "macro.dbt_expectations.test_equal_expression": {"unique_id": "macro.dbt_expectations.test_equal_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "test_equal_expression", "macro_sql": "{% test equal_expression(model, expression,\n compare_model=None,\n compare_expression=None,\n group_by=None,\n compare_group_by=None,\n row_condition=None,\n compare_row_condition=None,\n tolerance=0.0,\n tolerance_percent=None\n ) -%}\n\n {{ adapter.dispatch('test_equal_expression', 'dbt_expectations') (\n model,\n expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2422369}, "macro.dbt_expectations.default__test_equal_expression": {"unique_id": "macro.dbt_expectations.default__test_equal_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "default__test_equal_expression", "macro_sql": "\n\n{%- macro default__test_equal_expression(\n model,\n expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent) -%}\n\n {%- set compare_model = model if not compare_model else compare_model -%}\n {%- set compare_expression = expression if not compare_expression else compare_expression -%}\n {%- set compare_row_condition = row_condition if not compare_row_condition else compare_row_condition -%}\n {%- set compare_group_by = group_by if not compare_group_by else compare_group_by -%}\n\n {%- set n_cols = (group_by|length) if group_by else 0 %}\n with a as (\n {{ dbt_expectations.get_select(model, expression, row_condition, group_by) }}\n ),\n b as (\n {{ dbt_expectations.get_select(compare_model, compare_expression, compare_row_condition, compare_group_by) }}\n ),\n final as (\n\n select\n {% for i in range(1, n_cols + 1) -%}\n coalesce(a.col_{{ i }}, b.col_{{ i }}) as col_{{ i }},\n {% endfor %}\n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n {% if n_cols > 0 %}\n a\n full outer join\n b on\n {% for i in range(1, n_cols + 1) -%}\n a.col_{{ i }} = b.col_{{ i }} {% if not loop.last %}and{% endif %}\n {% endfor -%}\n {% else %}\n a cross join b\n {% endif %}\n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n {% if tolerance_percent %}\n expression_difference_percent > {{ tolerance_percent }}\n {% else %}\n expression_difference > {{ tolerance }}\n {% endif %}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.get_select"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.245245}, "macro.dbt_expectations.truth_expression": {"unique_id": "macro.dbt_expectations.truth_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "name": "truth_expression", "macro_sql": "{% macro truth_expression(expression) %}\n {{ adapter.dispatch('truth_expression', 'dbt_expectations') (expression) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2459378}, "macro.dbt_expectations.default__truth_expression": {"unique_id": "macro.dbt_expectations.default__truth_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "name": "default__truth_expression", "macro_sql": "{% macro default__truth_expression(expression) %}\n {{ expression }} as expression\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.24617}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "name": "test_expect_column_values_to_match_like_pattern", "macro_sql": "{% test expect_column_values_to_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.247375}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "name": "test_expect_column_values_to_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.249496}, "macro.dbt_expectations.test_expect_column_values_to_match_regex": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "name": "test_expect_column_values_to_match_regex", "macro_sql": "{% test expect_column_values_to_match_regex(model, column_name,\n regex,\n row_condition=None\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} > 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.250824}, "macro.dbt_expectations.test_expect_column_value_lengths_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "name": "test_expect_column_value_lengths_to_equal", "macro_sql": "{% test expect_column_value_lengths_to_equal(model, column_name,\n value,\n row_condition=None\n ) %}\n\n{% set expression = dbt_utils.length(column_name) ~ \" = \" ~ value %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.length", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.25217}, "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "name": "test_expect_column_value_lengths_to_be_between", "macro_sql": "{% test expect_column_value_lengths_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\n{{ dbt_utils.length(column_name) }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.length", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.254255}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "name": "test_expect_column_values_to_not_match_regex", "macro_sql": "{% test expect_column_values_to_not_match_regex(model, column_name,\n regex,\n row_condition=None\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.255741}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "name": "test_expect_column_values_to_not_match_regex_list", "macro_sql": "{% test expect_column_values_to_not_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for regex in regex_list %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0\n{%- if not loop.last %}\n{{ \" and \" if match_on == \"all\" else \" or \"}}\n{% endif -%}\n{% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.257931}, "macro.dbt_expectations.test_expect_column_values_to_match_regex_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "name": "test_expect_column_values_to_match_regex_list", "macro_sql": "{% test expect_column_values_to_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for regex in regex_list %}\n {{ dbt_expectations.regexp_instr(column_name, regex) }} > 0\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.260076}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "name": "test_expect_column_values_to_not_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.262871}, "macro.dbt_expectations._get_like_pattern_expression": {"unique_id": "macro.dbt_expectations._get_like_pattern_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "original_file_path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "name": "_get_like_pattern_expression", "macro_sql": "{% macro _get_like_pattern_expression(column_name, like_pattern, positive) %}\n{{ column_name }} {{ \"not\" if not positive else \"\" }} like '{{ like_pattern }}'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.263603}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "name": "test_expect_column_values_to_not_match_like_pattern", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.264817}, "macro.dbt_expectations.test_expect_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "name": "test_expect_row_values_to_have_recent_data", "macro_sql": "{% test expect_row_values_to_have_recent_data(model,\n column_name,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_row_values_to_have_recent_data', 'dbt_expectations') (model,\n column_name,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2669282}, "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "name": "default__test_expect_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_row_values_to_have_recent_data(model, column_name, datepart, interval, row_condition) %}\n{%- set default_start_date = '1970-01-01' -%}\nwith max_recency as (\n\n select max(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})) as max_timestamp\n from\n {{ model }}\n where\n cast({{ column_name }} as {{ dbt_utils.type_timestamp() }}) <= {{ dbt_date.now() }}\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('{{ default_start_date }}' as {{ dbt_utils.type_timestamp() }}))\n <\n cast({{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }} as {{ dbt_utils.type_timestamp() }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_date.now", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.268266}, "macro.dbt_expectations.test_expect_table_columns_to_contain_set": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_contain_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "name": "test_expect_table_columns_to_contain_set", "macro_sql": "{%- test expect_table_columns_to_contain_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n input_columns i\n left join\n relation_columns r on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n r.relation_column is null\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.271439}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "name": "test_expect_table_row_count_to_equal_other_table", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table(model, compare_model, factor=1, row_condition=None, compare_row_condition=None) -%}\n{{ dbt_expectations.test_equal_expression(model, \"count(*)\",\n compare_model=compare_model,\n compare_expression=\"count(*) * \" + factor|string,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.27244}, "macro.dbt_expectations.test_expect_table_columns_to_not_contain_set": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_not_contain_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql", "name": "test_expect_table_columns_to_not_contain_set", "macro_sql": "{%- test expect_table_columns_to_not_contain_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n -- catch any column in input list that is in the list of table columns\n select *\n from\n input_columns i\n inner join\n relation_columns r on r.relation_column = i.input_column\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.274882}, "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "name": "test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% test expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_grouped_row_values_to_have_recent_data', 'dbt_expectations') (model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.278409}, "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "name": "default__test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) %}\nwith latest_grouped_timestamps as (\n\n select\n {%- for g in group_by %}\n {{ g }},\n {%- endfor %}\n max(1) as join_key,\n max({{ timestamp_column }}) as latest_timestamp_column\n from\n {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n {{ dbt_utils.group_by(group_by | length )}}\n\n),\ntotal_row_counts as (\n\n select\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n latest_timestamp_column < {{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }}\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt_utils.dateadd", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.279566}, "macro.dbt_expectations.test_expect_column_to_exist": {"unique_id": "macro.dbt_expectations.test_expect_column_to_exist", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "original_file_path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "name": "test_expect_column_to_exist", "macro_sql": "{%- test expect_column_to_exist(model, column_name, column_index=None, transform=\"upper\") -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | map(transform) | join -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n\n {%- set matching_column_index = relation_column_names.index(column_name) if column_name in relation_column_names else -1 %}\n\n {%- if column_index -%}\n\n {%- set column_index_0 = column_index - 1 if column_index > 0 else 0 -%}\n\n {%- set column_index_matches = true if matching_column_index == column_index_0 else false %}\n\n {%- else -%}\n\n {%- set column_index_matches = true -%}\n\n {%- endif %}\n\n with test_data as (\n\n select\n cast('{{ column_name }}' as {{ dbt_utils.type_string() }}) as column_name,\n {{ matching_column_index }} as matching_column_index,\n {{ column_index_matches }} as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.282196}, "macro.dbt_expectations.test_expect_table_row_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "name": "test_expect_table_row_count_to_equal", "macro_sql": "{%- test expect_table_row_count_to_equal(model,\n value,\n group_by=None,\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_table_row_count_to_equal',\n 'dbt_expectations') (model,\n value,\n group_by,\n row_condition\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_equal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.284087}, "macro.dbt_expectations.default__test_expect_table_row_count_to_equal": {"unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "name": "default__test_expect_table_row_count_to_equal", "macro_sql": "\n\n\n\n{%- macro default__test_expect_table_row_count_to_equal(model,\n value,\n group_by,\n row_condition\n ) -%}\n{% set expression %}\ncount(*) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.284714}, "macro.dbt_expectations.test_expect_table_row_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "name": "test_expect_table_row_count_to_be_between", "macro_sql": "{%- test expect_table_row_count_to_be_between(model,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n{% set expression %}\ncount(*)\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.286714}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "name": "test_expect_table_row_count_to_equal_other_table_times_factor", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table_times_factor(model, compare_model, factor, row_condition=None, compare_row_condition=None) -%}\n{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table(model, compare_model,\n factor=factor,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.2875671}, "macro.dbt_expectations.test_expect_table_columns_to_match_set": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "name": "test_expect_table_columns_to_match_set", "macro_sql": "{%- test expect_table_columns_to_match_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n -- or any table column that is not in the input list\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.29037}, "macro.dbt_expectations._get_column_list": {"unique_id": "macro.dbt_expectations._get_column_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/_get_column_list.sql", "original_file_path": "macros/schema_tests/table_shape/_get_column_list.sql", "name": "_get_column_list", "macro_sql": "{%- macro _get_column_list(model, transform=\"upper\") -%}\n{%- set relation_columns = adapter.get_columns_in_relation(model) -%}\n{%- set relation_column_names = relation_columns | map(attribute=\"name\") | map(transform) | list -%}\n{%- do return(relation_column_names) -%}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.291359}, "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "name": "test_expect_table_columns_to_match_ordered_list", "macro_sql": "{%- test expect_table_columns_to_match_ordered_list(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select\n {{ loop.index }} as relation_column_idx,\n cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select\n {{ loop.index }} as input_column_idx,\n cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.294498}, "macro.dbt_expectations._list_intersect": {"unique_id": "macro.dbt_expectations._list_intersect", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/_list_intersect.sql", "original_file_path": "macros/schema_tests/table_shape/_list_intersect.sql", "name": "_list_intersect", "macro_sql": "{%- macro _list_intersect(list1, list2) -%}\n{%- set matching_items = [] -%}\n{%- for itm in list1 -%}\n {%- if itm in list2 -%}\n {%- do matching_items.append(itm) -%}\n {%- endif -%}\n{%- endfor -%}\n{%- do return(matching_items) -%}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.295587}, "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "name": "test_expect_table_column_count_to_equal_other_table", "macro_sql": "{%- test expect_table_column_count_to_equal_other_table(model, compare_model) -%}\n{%- if execute -%}\n{%- set number_columns = (adapter.get_columns_in_relation(model) | length) -%}\n{%- set compare_number_columns = (adapter.get_columns_in_relation(compare_model) | length) -%}\nwith test_data as (\n\n select\n {{ number_columns }} as number_columns,\n {{ compare_number_columns }} as compare_number_columns\n\n)\nselect *\nfrom test_data\nwhere\n number_columns != compare_number_columns\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.296741}, "macro.dbt_expectations.test_expect_table_column_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "name": "test_expect_table_column_count_to_equal", "macro_sql": "{%- test expect_table_column_count_to_equal(model, value) -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ value }} as value\n\n)\nselect *\nfrom test_data\nwhere\n number_actual_columns != value\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.297676}, "macro.dbt_expectations.test_expect_table_column_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "name": "test_expect_table_column_count_to_be_between", "macro_sql": "{%- test expect_table_column_count_to_be_between(model,\n min_value=None,\n max_value=None\n ) -%}\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\n\n{%- set expression %}\n( 1=1\n{%- if min_value %} and number_actual_columns >= min_value{% endif %}\n{%- if max_value %} and number_actual_columns <= max_value{% endif %}\n)\n{% endset -%}\n\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ min_value if min_value else 0 }} as min_value,\n {{ max_value if max_value else 0 }} as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not {{ expression }}\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.299798}, "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "name": "test_expect_column_values_to_not_be_in_set", "macro_sql": "{% test expect_column_values_to_not_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt_utils.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that match the set\n select\n v.value_field\n from\n all_values v\n join\n set_values s on v.value_field = s.value_field\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.301708}, "macro.dbt_expectations.test_expect_column_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "name": "test_expect_column_values_to_be_in_set", "macro_sql": "{% test expect_column_values_to_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt_utils.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.304565}, "macro.dbt_expectations.test_expect_column_values_to_be_increasing": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_increasing", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "name": "test_expect_column_values_to_be_increasing", "macro_sql": "{% test expect_column_values_to_be_increasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None,\n group_by=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \">\" if strictly else \">=\" -%}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n {{ column_name }} as value_field\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n value_field,\n lag(value_field) over\n {%- if not group_by -%}\n (order by sort_column)\n {%- else -%}\n (partition by {{ group_by | join(\", \") }} order by sort_column)\n {%- endif %} as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.307414}, "macro.dbt_expectations.test_expect_column_values_to_be_null": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_null", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "name": "test_expect_column_values_to_be_null", "macro_sql": "{% test expect_column_values_to_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.308477}, "macro.dbt_expectations.test_expect_column_values_to_be_unique": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_unique", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "name": "test_expect_column_values_to_be_unique", "macro_sql": "{% test expect_column_values_to_be_unique(model, column_name, row_condition=None) %}\n{{ dbt_expectations.test_expect_compound_columns_to_be_unique(model, [column_name], row_condition=row_condition) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_compound_columns_to_be_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3091872}, "macro.dbt_expectations.test_expect_column_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "name": "test_expect_column_values_to_be_between", "macro_sql": "{% test expect_column_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ column_name }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.311158}, "macro.dbt_expectations.test_expect_column_values_to_be_decreasing": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_decreasing", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "name": "test_expect_column_values_to_be_decreasing", "macro_sql": "{% test expect_column_values_to_be_decreasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None,\n group_by=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \"<\" if strictly else \"<=\" %}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n {{ column_name }} as value_field\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over\n {%- if not group_by -%}\n (order by sort_column)\n {%- else -%}\n (partition by {{ group_by | join(\", \") }} order by sort_column)\n {%- endif %} as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.313643}, "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "name": "test_expect_column_values_to_be_in_type_list", "macro_sql": "{%- test expect_column_values_to_be_in_type_list(model, column_name, column_type_list) -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | upper -%}\n {%- set columns_in_relation = adapter.get_columns_in_relation(model) -%}\n {%- set column_type_list = column_type_list| map(\"upper\") | list -%}\n with relation_columns as (\n\n {% for column in columns_in_relation %}\n select\n cast('{{ column.name | upper }}' as {{ dbt_utils.type_string() }}) as relation_column,\n cast('{{ column.dtype | upper }}' as {{ dbt_utils.type_string() }}) as relation_column_type\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = '{{ column_name }}'\n and\n relation_column_type not in ('{{ column_type_list | join(\"', '\") }}')\n\n )\n select *\n from test_data\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.315904}, "macro.dbt_expectations.test_expect_column_values_to_be_of_type": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_of_type", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "name": "test_expect_column_values_to_be_of_type", "macro_sql": "{%- test expect_column_values_to_be_of_type(model, column_name, column_type) -%}\n{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(model, column_name, [column_type]) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3165572}, "macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql", "name": "test_expect_column_values_to_have_consistent_casing", "macro_sql": "{% test expect_column_values_to_have_consistent_casing(model, column_name, display_inconsistent_columns=False) %}\n\nwith test_data as (\n\n select\n distinct {{ column_name }} as distinct_values\n from\n {{ model }}\n\n ),\n {% if display_inconsistent_columns %}\n validation_errors as (\n\n select\n lower(distinct_values) as inconsistent_columns,\n count(distinct_values) as set_count_case_insensitive\n from\n test_data\n group by 1\n having\n count(distinct_values) > 1\n\n )\n select * from validation_errors\n {% else %}\n validation_errors as (\n\n select\n count(1) as set_count,\n count(distinct lower(distinct_values)) as set_count_case_insensitive\n from\n test_data\n\n )\n select *\n from\n validation_errors\n where\n set_count != set_count_case_insensitive\n {% endif %}\n {%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.317518}, "macro.dbt_expectations.test_expect_column_values_to_not_be_null": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_null", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "name": "test_expect_column_values_to_not_be_null", "macro_sql": "{% test expect_column_values_to_not_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is not null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3185768}, "macro.dbt_expectations.test_expect_column_min_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_min_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "name": "test_expect_column_min_to_be_between", "macro_sql": "{% test expect_column_min_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmin({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.321064}, "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "name": "test_expect_column_unique_value_count_to_be_between", "macro_sql": "{% test expect_column_unique_value_count_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.322849}, "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "name": "test_expect_column_quantile_values_to_be_between", "macro_sql": "{% test expect_column_quantile_values_to_be_between(model, column_name,\n quantile,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.percentile_cont(column_name, quantile) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.324664}, "macro.dbt_expectations.test_expect_column_median_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_median_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "name": "test_expect_column_median_to_be_between", "macro_sql": "{% test expect_column_median_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.median(column_name) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.median", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.326396}, "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "name": "test_expect_column_proportion_of_unique_values_to_be_between", "macro_sql": "{% test expect_column_proportion_of_unique_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }})/count({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.328473}, "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "name": "test_expect_column_distinct_values_to_equal_set", "macro_sql": "{% test expect_column_distinct_values_to_equal_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as column_value\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n all_values v\n full outer join\n unique_set_values s on v.column_value = s.value_field\n where\n v.column_value is null or\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.330367}, "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "name": "test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% test expect_column_most_common_value_to_be_in_set(model, column_name,\n value_set,\n top_n,\n quote_values=False,\n data_type=\"decimal\",\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_column_most_common_value_to_be_in_set', 'dbt_expectations') (model, column_name, value_set, top_n, quote_values, data_type, row_condition) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.333336}, "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set": {"unique_id": "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "name": "default__test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% macro default__test_expect_column_most_common_value_to_be_in_set(model, column_name,\n value_set,\n top_n,\n quote_values,\n data_type,\n row_condition\n ) %}\n\nwith value_counts as (\n\n select\n {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %} as value_field,\n count(*) as value_count\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n group by {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %}\n\n),\nvalue_counts_ranked as (\n\n select\n *,\n row_number() over(order by value_count desc) as value_count_rank\n from\n value_counts\n\n),\nvalue_count_top_n as (\n\n select\n value_field\n from\n value_counts_ranked\n where\n value_count_rank = {{ top_n }}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n cast({{ value }} as {{ data_type }})\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n value_field\n from\n value_count_top_n\n where\n value_field not in (select value_field from unique_set_values)\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": 1649080790.335024}, "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "name": "test_expect_column_distinct_values_to_contain_set", "macro_sql": "{% test expect_column_distinct_values_to_contain_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values in set that are not in the list of values from the model\n select\n s.value_field\n from\n unique_set_values s\n left join\n all_values v on s.value_field = v.value_field\n where\n v.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3375869}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "name": "test_expect_column_distinct_count_to_equal", "macro_sql": "{% test expect_column_distinct_count_to_equal(model,\n column_name,\n value,\n quote_values=False,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3390899}, "macro.dbt_expectations.test_expect_column_sum_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_sum_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "name": "test_expect_column_sum_to_be_between", "macro_sql": "{% test expect_column_sum_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nsum({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3407621}, "macro.dbt_expectations.test_expect_column_stdev_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_stdev_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "name": "test_expect_column_stdev_to_be_between", "macro_sql": "{% test expect_column_stdev_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n {{ adapter.dispatch('test_expect_column_stdev_to_be_between', 'dbt_expectations') (\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_stdev_to_be_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.343252}, "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between": {"unique_id": "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "name": "default__test_expect_column_stdev_to_be_between", "macro_sql": "{% macro default__test_expect_column_stdev_to_be_between(\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) %}\n\n{% set expression %}\nstddev({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.344189}, "macro.dbt_expectations.test_expect_column_mean_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_mean_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "name": "test_expect_column_mean_to_be_between", "macro_sql": "{% test expect_column_mean_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\navg({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.346179}, "macro.dbt_expectations.test_expect_column_max_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_max_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "name": "test_expect_column_max_to_be_between", "macro_sql": "{% test expect_column_max_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmax({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3478389}, "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "name": "test_expect_column_distinct_count_to_be_greater_than", "macro_sql": "{% test expect_column_distinct_count_to_be_greater_than(model,\n column_name,\n value,\n quote_values=False,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) > {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.349256}, "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "name": "test_expect_column_distinct_values_to_be_in_set", "macro_sql": "{% test expect_column_distinct_values_to_be_in_set(model, column_name,\n value_set,\n quote_values=False,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n unique_set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.351315}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "name": "test_expect_column_distinct_count_to_equal_other_table", "macro_sql": "{% test expect_column_distinct_count_to_equal_other_table(model,\n compare_model,\n column_name,\n compare_column_name,\n row_condition=None,\n compare_row_condition=None\n ) %}\n{%- set expression -%}\ncount(distinct {{ column_name }})\n{%- endset -%}\n{%- set compare_expression -%}\n{%- if compare_column_name -%}\ncount(distinct {{ compare_column_name }})\n{%- else -%}\n{{ expression }}\n{%- endif -%}\n{%- endset -%}\n{{ dbt_expectations.test_equal_expression(\n model,\n expression=expression,\n compare_model=compare_model,\n compare_expression=compare_expression,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3542988}, "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart": {"unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "original_file_path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "name": "test_expect_row_values_to_have_data_for_every_n_datepart", "macro_sql": "{%- test expect_row_values_to_have_data_for_every_n_datepart(model,\n date_col,\n date_part=\"day\",\n interval=None,\n row_condition=None,\n exclusion_condition=None,\n test_start_date=None,\n test_end_date=None) -%}\n{% if not execute %}\n {{ return('') }}\n{% endif %}\n\n{% if not test_start_date or not test_end_date %}\n {% set sql %}\n\n select\n min({{ date_col }}) as start_{{ date_part }},\n max({{ date_col }}) as end_{{ date_part }}\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n {% endset %}\n\n {%- set dr = run_query(sql) -%}\n {%- set db_start_date = dr.columns[0].values()[0].strftime('%Y-%m-%d') -%}\n {%- set db_end_date = dr.columns[1].values()[0].strftime('%Y-%m-%d') -%}\n\n{% endif %}\n\n{% if not test_start_date %}\n{% set start_date = db_start_date %}\n{% else %}\n{% set start_date = test_start_date %}\n{% endif %}\n\n\n{% if not test_end_date %}\n{% set end_date = db_end_date %}\n{% else %}\n{% set end_date = test_end_date %}\n{% endif %}\nwith base_dates as (\n\n {{ dbt_date.get_base_dates(start_date=start_date, end_date=end_date, datepart=date_part) }}\n {% if interval %}\n {# \n Filter the date spine created above down to the interval granularity using a modulo operation.\n The number of date_parts after the start_date divided by the integer interval will produce no remainder for the desired intervals, \n e.g. for 2-day interval from a starting Jan 1, 2020:\n params: start_date = '2020-01-01', date_part = 'day', interval = 2\n date spine created above: [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-04, 2020-01-05, ...]\n The first parameter to the `mod` function would be the number of days between the start_date and the spine date, i.e. [0, 1, 2, 3, 4 ...]\n The second parameter to the `mod` function would be the integer interval, i.e. 2\n This modulo operation produces the following remainders: [0, 1, 0, 1, 0, ...]\n Filtering the spine only where this remainder == 0 will return a spine with every other day as desired, i.e. [2020-01-01, 2020-01-03, 2020-01-05, ...]\n #}\n where mod(\n cast({{ dbt_utils.datediff(\"'\" ~ start_date ~ \"'\", 'date_' ~ date_part, date_part) }} as {{ dbt_utils.type_int() }}),\n cast({{interval}} as {{ dbt_utils.type_int() }})\n ) = 0\n {% endif %}\n\n),\nmodel_data as (\n\n select\n {% if not interval %}\n\n cast({{ dbt_utils.date_trunc(date_part, date_col) }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n\n {% else %}\n {# \n Use a modulo operator to determine the number of intervals that a date_col is away from the interval-date spine \n and subtracts that amount to effectively slice each date_col record into its corresponding spine bucket,\n e.g. given a date_col of with records [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-11, 2020-01-12]\n if we want to slice these dates into their 2-day buckets starting Jan 1, 2020 (start_date = '2020-01-01', date_part='day', interval=2),\n the modulo operation described above will produce these remainders: [0, 1, 0, 0, 1]\n subtracting that number of days from the observations will produce records [2020-01-01, 2020-01-01, 2020-01-03, 2020-01-11, 2020-01-11],\n all of which align with records from the interval-date spine\n #}\n {{dbt_utils.dateadd(\n date_part, \n \"mod(\n cast(\" ~ dbt_utils.datediff(\"'\" ~ start_date ~ \"'\", date_col, date_part) ~ \" as \" ~ dbt_utils.type_int() ~ \" ),\n cast(\" ~ interval ~ \" as \" ~ dbt_utils.type_int() ~ \" )\n ) * (-1)\", \n \"cast( \" ~ dbt_utils.date_trunc(date_part, date_col) ~ \" as \" ~ dbt_expectations.type_datetime() ~ \")\"\n )}} as date_{{ date_part }},\n \n {% endif %}\n \n count(*) as row_cnt\n from\n {{ model }} f\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n group by\n date_{{date_part}}\n\n),\n\nfinal as (\n\n select\n cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n case when f.date_{{ date_part }} is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) = f.date_{{ date_part }}\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n{% if exclusion_condition %}\n and {{ exclusion_condition }}\n{% endif %}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_date.get_base_dates", "macro.dbt_utils.datediff", "macro.dbt_utils.type_int", "macro.dbt_utils.date_trunc", "macro.dbt_expectations.type_datetime", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.364162}, "macro.dbt_expectations._get_metric_expression": {"unique_id": "macro.dbt_expectations._get_metric_expression", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "_get_metric_expression", "macro_sql": "{%- macro _get_metric_expression(metric_column, take_logs) -%}\n\n{%- if take_logs %}\n{%- set expr = \"nullif(\" ~ metric_column ~ \", 0)\" -%}\ncoalesce({{ dbt_expectations.log_natural(expr) }}, 0)\n{%- else -%}\ncoalesce({{ metric_column }}, 0)\n{%- endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.log_natural"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.370431}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n period='day',\n lookback_periods=1,\n trend_periods=7,\n test_periods=14,\n sigma_threshold=3,\n sigma_threshold_upper=None,\n sigma_threshold_lower=None,\n take_diffs=true,\n take_logs=true\n ) -%}\n {{ adapter.dispatch('test_expect_column_values_to_be_within_n_moving_stdevs', 'dbt_expectations') (model,\n column_name,\n date_column_name,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.371634}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs": {"unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "default__test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) %}\n\n{%- set sigma_threshold_upper = sigma_threshold_upper if sigma_threshold_upper else sigma_threshold -%}\n{%- set sigma_threshold_lower = sigma_threshold_lower if sigma_threshold_lower else -1 * sigma_threshold -%}\n\nwith metric_values as (\n\n with grouped_metric_values as (\n\n select\n {{ dbt_utils.date_trunc(period, date_column_name) }} as metric_period,\n sum({{ column_name }}) as agg_metric_value\n from\n {{ model }}\n group by\n 1\n\n ),\n {%- if take_diffs %}\n grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, {{ lookback_periods }}) over(order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n -\n {{ dbt_expectations._get_metric_expression(\"prior_agg_metric_value\", take_logs) }}\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n {%- else %}\n\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n from\n grouped_metric_values\n\n {%- endif %}\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over(order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over(order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n {{ dbt_utils.dateadd(period, -test_periods, dbt_utils.date_trunc(period, dbt_date.now())) }}\n as {{ dbt_utils.type_timestamp() }})\n and\n metric_period < {{ dbt_utils.date_trunc(period, dbt_date.now()) }}\n and\n\n not (\n metric_test_sigma >= {{ sigma_threshold_lower }} and\n metric_test_sigma <= {{ sigma_threshold_upper }}\n )\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_expectations._get_metric_expression", "macro.dbt_utils.dateadd", "macro.dbt_date.now", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.374115}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "name": "test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by=None,\n sigma_threshold=3\n ) -%}\n {{ adapter.dispatch('test_expect_column_values_to_be_within_n_stdevs', 'dbt_expectations') (model, column_name, group_by, sigma_threshold) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3759391}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs": {"unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "name": "default__test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by,\n sigma_threshold\n ) %}\nwith metric_values as (\n\n {% if group_by -%}\n select\n {{ group_by }} as metric_date,\n sum({{ column_name }}) as {{ column_name }}\n from\n {{ model }}\n group by\n 1\n {%- else -%}\n select\n {{ column_name }} as {{ column_name }}\n from\n {{ model }}\n {%- endif %}\n\n),\nmetric_values_with_statistics as (\n\n select\n *,\n avg({{ column_name }}) over() as {{ column_name }}_average,\n stddev({{ column_name }}) over() as {{ column_name }}_stddev\n from\n metric_values\n\n),\nmetric_values_z_scores as (\n\n select\n *,\n ({{ column_name }} - {{ column_name }}_average)/{{ column_name }}_stddev as {{ column_name }}_sigma\n from\n metric_values_with_statistics\n\n)\nselect\n *\nfrom\n metric_values_z_scores\nwhere\n abs({{ column_name }}_sigma) > {{ sigma_threshold }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.377128}, "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record": {"unique_id": "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "name": "test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% test expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_select_column_values_to_be_unique_within_record', 'dbt_expectations') (model, column_list, quote_columns, ignore_row_if, row_condition) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.380634}, "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record": {"unique_id": "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "name": "default__test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% macro default__test_expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns,\n ignore_row_if,\n row_condition\n ) %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.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_columns ~\"'.'\"\n ) }}\n{% endif %}\n\nwith column_values as (\n\n select\n row_number() over(order by 1) as row_index,\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n from {{ model }}\n where 1=1\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n {% if ignore_row_if == \"all_values_are_missing\" %}\n and\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} and {% endif %}\n {%- endfor %}\n )\n {% elif ignore_row_if == \"any_value_is_missing\" %}\n and\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} or {% endif %}\n {%- endfor %}\n )\n {% endif %}\n\n),\nunpivot_columns as (\n\n {% for column in columns %}\n select row_index, '{{ column }}' as column_name, {{ column }} as column_value from column_values\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n\n select\n row_index,\n count(distinct column_value) as column_values\n from unpivot_columns\n group by 1\n having count(distinct column_value) < {{ columns | length }}\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": 1649080790.383619}, "macro.dbt_expectations.test_expect_compound_columns_to_be_unique": {"unique_id": "macro.dbt_expectations.test_expect_compound_columns_to_be_unique", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "original_file_path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "name": "test_expect_compound_columns_to_be_unique", "macro_sql": "{% test expect_compound_columns_to_be_unique(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for expect_compound_columns_to_be_unique test must be one of [True, False] Got: '\" ~ quote_columns ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set row_condition_ext %}\n\n{% if row_condition %}\n {{ row_condition }} and\n{% endif %}\n\n{% if ignore_row_if == \"all_values_are_missing\" %}\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} and {% endif %}\n {%- endfor %}\n )\n{% elif ignore_row_if == \"any_value_is_missing\" %}\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} or {% endif %}\n {%- endfor %}\n )\n{% endif %}\n{% endset %}\n\nwith validation_errors as (\n\n select\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n from {{ model }}\n where 1=1\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n group by\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n having count(*) > 1\n\n)\nselect * from validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.389317}, "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "name": "test_expect_multicolumn_sum_to_equal", "macro_sql": "{% test expect_multicolumn_sum_to_equal(model,\n column_list,\n sum_total,\n group_by=None,\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for column in column_list %}\nsum({{ column }}){% if not loop.last %} + {% endif %}\n{% endfor %} = {{ sum_total }}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.391213}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "name": "test_expect_column_pair_values_to_be_equal", "macro_sql": "{% test expect_column_pair_values_to_be_equal(model,\n column_A,\n column_B,\n row_condition=None\n ) %}\n\n{% set operator = \"=\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.392586}, "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "name": "test_expect_column_pair_values_A_to_be_greater_than_B", "macro_sql": "{% test expect_column_pair_values_A_to_be_greater_than_B(model,\n column_A,\n column_B,\n or_equal=False,\n row_condition=None\n ) %}\n\n{% set operator = \">=\" if or_equal else \">\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.394133}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/claus/dev/calogica/dbt-expectations/integration_tests/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "name": "test_expect_column_pair_values_to_be_in_set", "macro_sql": "{% test expect_column_pair_values_to_be_in_set(model,\n column_A,\n column_B,\n value_pairs_set,\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for pair in value_pairs_set %}\n{%- if (pair | length) == 2 %}\n({{ column_A }} = {{ pair[0] }} and {{ column_B }} = {{ pair[1] }}){% if not loop.last %} or {% endif %}\n{% else %}\n{{ exceptions.raise_compiler_error(\n \"`value_pairs_set` argument for expect_column_pair_values_to_be_in_set test cannot have more than 2 item per element.\n Got: '\" ~ pair ~ \"'.'\"\n ) }}\n{% endif %}\n{% endfor %}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1649080790.3971179}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Users/claus/.pyenv/versions/3.9.9/envs/dbt/lib/python3.9/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.dbt_expectations_integration_tests.data_test": [], "model.dbt_expectations_integration_tests.series_4": [], "model.dbt_expectations_integration_tests.timeseries_data_grouped": ["model.dbt_expectations_integration_tests.series_10", "model.dbt_expectations_integration_tests.series_4", "model.dbt_expectations_integration_tests.timeseries_base"], "model.dbt_expectations_integration_tests.timeseries_hourly": [], "model.dbt_expectations_integration_tests.timeseries_base": [], "model.dbt_expectations_integration_tests.timeseries_data": ["model.dbt_expectations_integration_tests.timeseries_base"], "model.dbt_expectations_integration_tests.window_function_test": [], "model.dbt_expectations_integration_tests.emails": [], "model.dbt_expectations_integration_tests.series_10": [], "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended": ["model.dbt_expectations_integration_tests.series_10", "model.dbt_expectations_integration_tests.timeseries_hourly"], "model.dbt_expectations_integration_tests.data_test_factored": [], "model.dbt_expectations_integration_tests.timeseries_data_extended": ["model.dbt_expectations_integration_tests.series_10", "model.dbt_expectations_integration_tests.timeseries_base"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd": ["model.dbt_expectations_integration_tests.emails"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b": ["model.dbt_expectations_integration_tests.timeseries_data", "model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21": ["model.dbt_expectations_integration_tests.timeseries_data", "model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7": ["model.dbt_expectations_integration_tests.timeseries_data"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560": ["model.dbt_expectations_integration_tests.timeseries_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071": ["model.dbt_expectations_integration_tests.data_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e": ["model.dbt_expectations_integration_tests.data_test", "model.dbt_expectations_integration_tests.data_test_factored"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9": ["model.dbt_expectations_integration_tests.window_function_test"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47": ["model.dbt_expectations_integration_tests.window_function_test"]}, "child_map": {"model.dbt_expectations_integration_tests.data_test": ["test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb", "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb", "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f", "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f", "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac", "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67", "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372", "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071", "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e", "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af"], "model.dbt_expectations_integration_tests.series_4": ["model.dbt_expectations_integration_tests.timeseries_data_grouped"], "model.dbt_expectations_integration_tests.timeseries_data_grouped": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781", "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8", "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b"], "model.dbt_expectations_integration_tests.timeseries_hourly": ["model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "model.dbt_expectations_integration_tests.timeseries_base": ["model.dbt_expectations_integration_tests.timeseries_data", "model.dbt_expectations_integration_tests.timeseries_data_extended", "model.dbt_expectations_integration_tests.timeseries_data_grouped"], "model.dbt_expectations_integration_tests.timeseries_data": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa"], "model.dbt_expectations_integration_tests.window_function_test": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9"], "model.dbt_expectations_integration_tests.emails": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5"], "model.dbt_expectations_integration_tests.series_10": ["model.dbt_expectations_integration_tests.timeseries_data_extended", "model.dbt_expectations_integration_tests.timeseries_data_grouped", "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"], "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8"], "model.dbt_expectations_integration_tests.data_test_factored": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e"], "model.dbt_expectations_integration_tests.timeseries_data_extended": ["test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f", "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560", "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d", "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c"], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480": [], "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af": [], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb": [], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790": [], "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9": [], "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47": []}} \ No newline at end of file diff --git a/dbt_packages/dbt_expectations/docs/run_results.json b/dbt_packages/dbt_expectations/docs/run_results.json new file mode 100644 index 0000000..aa57cbe --- /dev/null +++ b/dbt_packages/dbt_expectations/docs/run_results.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.4", "generated_at": "2022-04-04T13:59:53.906391Z", "invocation_id": "cd337e8c-7562-4ea1-a984-9fb3a454bc80", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.255111Z", "completed_at": "2022-04-04T13:59:52.260229Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.260649Z", "completed_at": "2022-04-04T13:59:52.260664Z"}], "thread_id": "Thread-1", "execution_time": 0.006472349166870117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.data_test"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.298477Z", "completed_at": "2022-04-04T13:59:52.303739Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.304285Z", "completed_at": "2022-04-04T13:59:52.304298Z"}], "thread_id": "Thread-1", "execution_time": 0.043018341064453125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.data_test_factored"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.306335Z", "completed_at": "2022-04-04T13:59:52.309707Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.310220Z", "completed_at": "2022-04-04T13:59:52.310231Z"}], "thread_id": "Thread-1", "execution_time": 0.00503087043762207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.emails"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.312392Z", "completed_at": "2022-04-04T13:59:52.316967Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.317462Z", "completed_at": "2022-04-04T13:59:52.317472Z"}], "thread_id": "Thread-1", "execution_time": 0.006440877914428711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.series_10"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.319180Z", "completed_at": "2022-04-04T13:59:52.323652Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.324144Z", "completed_at": "2022-04-04T13:59:52.324153Z"}], "thread_id": "Thread-1", "execution_time": 0.0061168670654296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.series_4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.325986Z", "completed_at": "2022-04-04T13:59:52.361946Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.362377Z", "completed_at": "2022-04-04T13:59:52.362387Z"}], "thread_id": "Thread-1", "execution_time": 0.03797769546508789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_base"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.364626Z", "completed_at": "2022-04-04T13:59:52.381426Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.381869Z", "completed_at": "2022-04-04T13:59:52.381880Z"}], "thread_id": "Thread-1", "execution_time": 0.018798112869262695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.384042Z", "completed_at": "2022-04-04T13:59:52.387805Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.388213Z", "completed_at": "2022-04-04T13:59:52.388221Z"}], "thread_id": "Thread-1", "execution_time": 0.005149126052856445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.window_function_test"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.389724Z", "completed_at": "2022-04-04T13:59:52.396541Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.396950Z", "completed_at": "2022-04-04T13:59:52.396959Z"}], "thread_id": "Thread-1", "execution_time": 0.008091926574707031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_ref_data_test___sum_col_numeric_a___idx.b487d295fb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.398377Z", "completed_at": "2022-04-04T13:59:52.405086Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.405483Z", "completed_at": "2022-04-04T13:59:52.405491Z"}], "thread_id": "Thread-1", "execution_time": 0.007968902587890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_a_5___ref_data_test___sum_col_numeric_a___idx__0_5.ce68b2893f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.406867Z", "completed_at": "2022-04-04T13:59:52.414698Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.415096Z", "completed_at": "2022-04-04T13:59:52.415104Z"}], "thread_id": "Thread-1", "execution_time": 0.009083986282348633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_equal_expression_data_test_sum_col_numeric_b___ref_data_test___sum_col_numeric_a_.674a29f4ac"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.416488Z", "completed_at": "2022-04-04T13:59:52.422461Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.422853Z", "completed_at": "2022-04-04T13:59:52.422861Z"}], "thread_id": "Thread-1", "execution_time": 0.007202863693237305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_be_in_set_data_test_col_string_a__True__a__b__c__d.ba496b564d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.424225Z", "completed_at": "2022-04-04T13:59:52.429883Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.430360Z", "completed_at": "2022-04-04T13:59:52.430370Z"}], "thread_id": "Thread-1", "execution_time": 0.007029056549072266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_contain_set_data_test_col_string_a__True__a__b.cb3359e163"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.431784Z", "completed_at": "2022-04-04T13:59:52.438110Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.438514Z", "completed_at": "2022-04-04T13:59:52.438522Z"}], "thread_id": "Thread-1", "execution_time": 0.007564067840576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_values_to_equal_set_data_test_col_string_a__True__a__b__c__c.351d3e42e2"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.439895Z", "completed_at": "2022-04-04T13:59:52.445444Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.445850Z", "completed_at": "2022-04-04T13:59:52.445859Z"}], "thread_id": "Thread-1", "execution_time": 0.006822824478149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_max_to_be_between_data_test_col_numeric_a__1__1.da51d2d9cb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.447283Z", "completed_at": "2022-04-04T13:59:52.452728Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.453135Z", "completed_at": "2022-04-04T13:59:52.453142Z"}], "thread_id": "Thread-1", "execution_time": 0.006708860397338867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_mean_to_be_between_data_test_col_numeric_a__1_5__0.885aa2d309"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.454538Z", "completed_at": "2022-04-04T13:59:52.461212Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.461652Z", "completed_at": "2022-04-04T13:59:52.461662Z"}], "thread_id": "Thread-1", "execution_time": 0.007990837097167969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_min_to_be_between_data_test_col_numeric_a__0__0.0b9263ab44"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.463101Z", "completed_at": "2022-04-04T13:59:52.467872Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.468268Z", "completed_at": "2022-04-04T13:59:52.468276Z"}], "thread_id": "Thread-1", "execution_time": 0.0060460567474365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_most_common_value_to_be_in_set_data_test_col_numeric_a__1__0_5.0c353bf758"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.469663Z", "completed_at": "2022-04-04T13:59:52.475306Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.475725Z", "completed_at": "2022-04-04T13:59:52.475735Z"}], "thread_id": "Thread-1", "execution_time": 0.006947994232177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a_10__col_numeric_a.95a5cc1fac"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.477214Z", "completed_at": "2022-04-04T13:59:52.483172Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.483590Z", "completed_at": "2022-04-04T13:59:52.483600Z"}], "thread_id": "Thread-1", "execution_time": 0.007239818572998047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_A_to_be_greater_than_B_data_test_col_numeric_a__col_numeric_a__True.996ee156f4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.485057Z", "completed_at": "2022-04-04T13:59:52.491140Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.491577Z", "completed_at": "2022-04-04T13:59:52.491588Z"}], "thread_id": "Thread-1", "execution_time": 0.00745081901550293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_equal_data_test_col_numeric_a__col_numeric_a.6237de7ec0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.493092Z", "completed_at": "2022-04-04T13:59:52.500762Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.501175Z", "completed_at": "2022-04-04T13:59:52.501185Z"}], "thread_id": "Thread-1", "execution_time": 0.008983612060546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_pair_values_to_be_in_set_data_test_col_numeric_a__col_numeric_b___0_1____1_0____0_5_0_5____0_5_0_5_.fcd2f00790"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.502621Z", "completed_at": "2022-04-04T13:59:52.508038Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.508442Z", "completed_at": "2022-04-04T13:59:52.508451Z"}], "thread_id": "Thread-1", "execution_time": 0.0066950321197509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_proportion_of_unique_values_to_be_between_data_test_col_numeric_a__0_75__0.50b672f9f5"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.509906Z", "completed_at": "2022-04-04T13:59:52.515914Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.516431Z", "completed_at": "2022-04-04T13:59:52.516443Z"}], "thread_id": "Thread-1", "execution_time": 0.007455110549926758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__0__True.0828889e83"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.517943Z", "completed_at": "2022-04-04T13:59:52.523695Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.524095Z", "completed_at": "2022-04-04T13:59:52.524104Z"}], "thread_id": "Thread-1", "execution_time": 0.007025003433227539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_stdev_to_be_between_data_test_col_numeric_a__2__0.6aea0941f3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.525514Z", "completed_at": "2022-04-04T13:59:52.531373Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.531782Z", "completed_at": "2022-04-04T13:59:52.531791Z"}], "thread_id": "Thread-1", "execution_time": 0.007143974304199219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_sum_to_be_between_data_test_col_numeric_a__3__1.768d8a3df1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.533216Z", "completed_at": "2022-04-04T13:59:52.584061Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.584492Z", "completed_at": "2022-04-04T13:59:52.584502Z"}], "thread_id": "Thread-1", "execution_time": 0.05270218849182129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_1__idx.fe00acd806"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.586531Z", "completed_at": "2022-04-04T13:59:52.617106Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.617524Z", "completed_at": "2022-04-04T13:59:52.617534Z"}], "thread_id": "Thread-1", "execution_time": 0.032476186752319336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_3__col_numeric_a.707ebd64f9"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.619555Z", "completed_at": "2022-04-04T13:59:52.650927Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.651335Z", "completed_at": "2022-04-04T13:59:52.651346Z"}], "thread_id": "Thread-1", "execution_time": 0.033164024353027344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_to_exist_data_test_col_numeric_a.05ed4c08ef"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.653301Z", "completed_at": "2022-04-04T13:59:52.660969Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.661651Z", "completed_at": "2022-04-04T13:59:52.661665Z"}], "thread_id": "Thread-1", "execution_time": 0.009293794631958008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_unique_value_count_to_be_between_data_test_col_numeric_a__3__3.29365f2765"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.663172Z", "completed_at": "2022-04-04T13:59:52.668934Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.669339Z", "completed_at": "2022-04-04T13:59:52.669348Z"}], "thread_id": "Thread-1", "execution_time": 0.0070400238037109375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__1.11ec77adb3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.670749Z", "completed_at": "2022-04-04T13:59:52.676255Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.676670Z", "completed_at": "2022-04-04T13:59:52.676679Z"}], "thread_id": "Thread-1", "execution_time": 0.0067899227142333984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4.c9921ddc5a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.678295Z", "completed_at": "2022-04-04T13:59:52.683865Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.684263Z", "completed_at": "2022-04-04T13:59:52.684272Z"}], "thread_id": "Thread-1", "execution_time": 0.006963253021240234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_be_between_data_test_col_string_b__4__1.7124d69fa8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.685649Z", "completed_at": "2022-04-04T13:59:52.691144Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.691566Z", "completed_at": "2022-04-04T13:59:52.691575Z"}], "thread_id": "Thread-1", "execution_time": 0.006788730621337891, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_value_lengths_to_equal_data_test_col_string_a__1.914eeb47db"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.692995Z", "completed_at": "2022-04-04T13:59:52.698674Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.699075Z", "completed_at": "2022-04-04T13:59:52.699085Z"}], "thread_id": "Thread-1", "execution_time": 0.006958723068237305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__0.38e10ae5de"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.700553Z", "completed_at": "2022-04-04T13:59:52.707589Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.707992Z", "completed_at": "2022-04-04T13:59:52.708001Z"}], "thread_id": "Thread-1", "execution_time": 0.008321046829223633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_between_data_test_col_numeric_a__1__0.dd0c29c89d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.710338Z", "completed_at": "2022-04-04T13:59:52.717152Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.717552Z", "completed_at": "2022-04-04T13:59:52.717560Z"}], "thread_id": "Thread-1", "execution_time": 0.008819341659545898, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_set_data_test_col_string_a__True__a__b__c.0d9c524932"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.719031Z", "completed_at": "2022-04-04T13:59:52.724213Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.724614Z", "completed_at": "2022-04-04T13:59:52.724624Z"}], "thread_id": "Thread-1", "execution_time": 0.0064661502838134766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_col_numeric_a__col_numeric_a__False.275c036446"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.726061Z", "completed_at": "2022-04-04T13:59:52.731596Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.732023Z", "completed_at": "2022-04-04T13:59:52.732033Z"}], "thread_id": "Thread-1", "execution_time": 0.006970882415771484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_data_test_idx__idx.f1baf74a63"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.733492Z", "completed_at": "2022-04-04T13:59:52.738714Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.739139Z", "completed_at": "2022-04-04T13:59:52.739148Z"}], "thread_id": "Thread-1", "execution_time": 0.006521701812744141, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_null_data_test_col_null.0be3aa326a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.740558Z", "completed_at": "2022-04-04T13:59:52.745397Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.745859Z", "completed_at": "2022-04-04T13:59:52.745868Z"}], "thread_id": "Thread-1", "execution_time": 0.006170034408569336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_unique_data_test_idx.1fedbd4c8c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.748713Z", "completed_at": "2022-04-04T13:59:52.753267Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.753667Z", "completed_at": "2022-04-04T13:59:52.753676Z"}], "thread_id": "Thread-1", "execution_time": 0.0072479248046875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a.97aaa47da3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.755070Z", "completed_at": "2022-04-04T13:59:52.759680Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.760081Z", "completed_at": "2022-04-04T13:59:52.760089Z"}], "thread_id": "Thread-1", "execution_time": 0.005868673324584961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_have_consistent_casing_data_test_col_string_a__True.dbf8671a4f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.761639Z", "completed_at": "2022-04-04T13:59:52.767418Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.767820Z", "completed_at": "2022-04-04T13:59:52.767829Z"}], "thread_id": "Thread-1", "execution_time": 0.0070798397064208984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_a__True__2__3.bba7663cef"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.769238Z", "completed_at": "2022-04-04T13:59:52.774965Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.775368Z", "completed_at": "2022-04-04T13:59:52.775377Z"}], "thread_id": "Thread-1", "execution_time": 0.0070002079010009766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_in_set_data_test_col_string_b__True__a__c.430e7a2045"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.776780Z", "completed_at": "2022-04-04T13:59:52.781992Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.782404Z", "completed_at": "2022-04-04T13:59:52.782414Z"}], "thread_id": "Thread-1", "execution_time": 0.00651097297668457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_be_null_data_test_col_numeric_a.1c5c036a67"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.783841Z", "completed_at": "2022-04-04T13:59:52.791522Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.792014Z", "completed_at": "2022-04-04T13:59:52.792025Z"}], "thread_id": "Thread-1", "execution_time": 0.009088993072509766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_compound_columns_to_be_unique_data_test_date_col__col_string_b__any_value_is_missing.6809061372"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.793514Z", "completed_at": "2022-04-04T13:59:52.799736Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.800156Z", "completed_at": "2022-04-04T13:59:52.800166Z"}], "thread_id": "Thread-1", "execution_time": 0.007647275924682617, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_multicolumn_sum_to_equal_data_test_col_numeric_a__col_numeric_b__4.491d71e071"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.801607Z", "completed_at": "2022-04-04T13:59:52.807757Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.808164Z", "completed_at": "2022-04-04T13:59:52.808172Z"}], "thread_id": "Thread-1", "execution_time": 0.007433176040649414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_select_column_values_to_be_unique_within_record_data_test_col_string_a__col_string_b__any_value_is_missing.4673d37284"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.809545Z", "completed_at": "2022-04-04T13:59:52.836294Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.836712Z", "completed_at": "2022-04-04T13:59:52.836723Z"}], "thread_id": "Thread-1", "execution_time": 0.028562068939208984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_1.81327d9e76"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.838686Z", "completed_at": "2022-04-04T13:59:52.866461Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.866880Z", "completed_at": "2022-04-04T13:59:52.866891Z"}], "thread_id": "Thread-1", "execution_time": 0.029651165008544922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10.53e3f2be23"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.868891Z", "completed_at": "2022-04-04T13:59:52.894554Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.895150Z", "completed_at": "2022-04-04T13:59:52.895162Z"}], "thread_id": "Thread-1", "execution_time": 0.027773141860961914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_be_between_data_test_10__1.31fd1ecbff"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.897263Z", "completed_at": "2022-04-04T13:59:52.922860Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.923308Z", "completed_at": "2022-04-04T13:59:52.923318Z"}], "thread_id": "Thread-1", "execution_time": 0.02747201919555664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_data_test_7.552fe2a555"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.925298Z", "completed_at": "2022-04-04T13:59:52.961006Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.961435Z", "completed_at": "2022-04-04T13:59:52.961447Z"}], "thread_id": "Thread-1", "execution_time": 0.03757905960083008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_column_count_to_equal_other_table_data_test_ref_data_test_.47d89a52cb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:52.963580Z", "completed_at": "2022-04-04T13:59:52.997912Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:52.998330Z", "completed_at": "2022-04-04T13:59:52.998341Z"}], "thread_id": "Thread-1", "execution_time": 0.03623485565185547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_contain_set_data_test_col_numeric_b__col_string_a.428ef19067"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.000410Z", "completed_at": "2022-04-04T13:59:53.035067Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.035476Z", "completed_at": "2022-04-04T13:59:53.035487Z"}], "thread_id": "Thread-1", "execution_time": 0.03648209571838379, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.847d680085"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.037402Z", "completed_at": "2022-04-04T13:59:53.070661Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.071067Z", "completed_at": "2022-04-04T13:59:53.071077Z"}], "thread_id": "Thread-1", "execution_time": 0.035143136978149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_set_data_test_idx__date_col__col_numeric_a__col_numeric_b__col_string_a__col_string_b__col_null.43007c4dca"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.073022Z", "completed_at": "2022-04-04T13:59:53.103058Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.103480Z", "completed_at": "2022-04-04T13:59:53.103490Z"}], "thread_id": "Thread-1", "execution_time": 0.0318751335144043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_not_contain_set_data_test_col_numeric_c__col_string_d.d79c96d480"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.105456Z", "completed_at": "2022-04-04T13:59:53.112069Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.112470Z", "completed_at": "2022-04-04T13:59:53.112480Z"}], "thread_id": "Thread-1", "execution_time": 0.007885932922363281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_1.2707fd03e7"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.113931Z", "completed_at": "2022-04-04T13:59:53.119679Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.120095Z", "completed_at": "2022-04-04T13:59:53.120106Z"}], "thread_id": "Thread-1", "execution_time": 0.007064104080200195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4.740d584f1d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.121542Z", "completed_at": "2022-04-04T13:59:53.127418Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.127847Z", "completed_at": "2022-04-04T13:59:53.127858Z"}], "thread_id": "Thread-1", "execution_time": 0.007190704345703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_data_test_4__1.68b3ca52d7"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.129296Z", "completed_at": "2022-04-04T13:59:53.134272Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.134694Z", "completed_at": "2022-04-04T13:59:53.134704Z"}], "thread_id": "Thread-1", "execution_time": 0.0062868595123291016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_data_test_4.0893914b47"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.136169Z", "completed_at": "2022-04-04T13:59:53.143317Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.143744Z", "completed_at": "2022-04-04T13:59:53.143754Z"}], "thread_id": "Thread-1", "execution_time": 0.008478164672851562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_data_test_ref_data_test___1_1__1_1.bb1a037ebc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.145219Z", "completed_at": "2022-04-04T13:59:53.150893Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.151318Z", "completed_at": "2022-04-04T13:59:53.151329Z"}], "thread_id": "Thread-1", "execution_time": 0.006994962692260742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expression_is_true_data_test__col_numeric_a_col_numeric_b_1_.72e60a34af"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.152774Z", "completed_at": "2022-04-04T13:59:53.160110Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.160587Z", "completed_at": "2022-04-04T13:59:53.160599Z"}], "thread_id": "Thread-1", "execution_time": 0.00873708724975586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_equal_other_table_times_factor_data_test_factored_ref_data_test___2.297ec8375e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.162177Z", "completed_at": "2022-04-04T13:59:53.167870Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.168290Z", "completed_at": "2022-04-04T13:59:53.168301Z"}], "thread_id": "Thread-1", "execution_time": 0.007014036178588867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_emails_email_address___.08c0c874a1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.169801Z", "completed_at": "2022-04-04T13:59:53.175662Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.176054Z", "completed_at": "2022-04-04T13:59:53.176063Z"}], "thread_id": "Thread-1", "execution_time": 0.007116794586181641, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_like_pattern_list_emails_email_address______.004645a3ac"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.177448Z", "completed_at": "2022-04-04T13:59:53.183055Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.183524Z", "completed_at": "2022-04-04T13:59:53.183534Z"}], "thread_id": "Thread-1", "execution_time": 0.006960868835449219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_emails_email_address___.9de7a56999"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.184942Z", "completed_at": "2022-04-04T13:59:53.190997Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.191403Z", "completed_at": "2022-04-04T13:59:53.191412Z"}], "thread_id": "Thread-1", "execution_time": 0.0074138641357421875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_match_regex_list_emails_email_address______.959ffbd98d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.192788Z", "completed_at": "2022-04-04T13:59:53.200079Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.200515Z", "completed_at": "2022-04-04T13:59:53.200526Z"}], "thread_id": "Thread-1", "execution_time": 0.008599996566772461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_emails_email_address___.969be3889d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.201966Z", "completed_at": "2022-04-04T13:59:53.243059Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.243597Z", "completed_at": "2022-04-04T13:59:53.243609Z"}], "thread_id": "Thread-1", "execution_time": 0.042584896087646484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_like_pattern_list_emails_email_address______.31da73e0cd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.245339Z", "completed_at": "2022-04-04T13:59:53.251912Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.252466Z", "completed_at": "2022-04-04T13:59:53.252479Z"}], "thread_id": "Thread-1", "execution_time": 0.008186101913452148, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_emails_email_address___.ff3a15060f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.254218Z", "completed_at": "2022-04-04T13:59:53.261355Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.261850Z", "completed_at": "2022-04-04T13:59:53.261862Z"}], "thread_id": "Thread-1", "execution_time": 0.008671998977661133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_not_match_regex_list_emails_email_address______.8bac11c2c5"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.263489Z", "completed_at": "2022-04-04T13:59:53.269476Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.269956Z", "completed_at": "2022-04-04T13:59:53.269965Z"}], "thread_id": "Thread-1", "execution_time": 0.0074160099029541016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.271770Z", "completed_at": "2022-04-04T13:59:53.277240Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.277653Z", "completed_at": "2022-04-04T13:59:53.277663Z"}], "thread_id": "Thread-1", "execution_time": 0.0071408748626708984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_data_extended"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.279692Z", "completed_at": "2022-04-04T13:59:53.286691Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.287118Z", "completed_at": "2022-04-04T13:59:53.287127Z"}], "thread_id": "Thread-1", "execution_time": 0.008796930313110352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_data_grouped"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.288764Z", "completed_at": "2022-04-04T13:59:53.294055Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.294466Z", "completed_at": "2022-04-04T13:59:53.294476Z"}], "thread_id": "Thread-1", "execution_time": 0.006582021713256836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_expectations_integration_tests.timeseries_hourly_data_extended"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.296057Z", "completed_at": "2022-04-04T13:59:53.301474Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.301945Z", "completed_at": "2022-04-04T13:59:53.301953Z"}], "thread_id": "Thread-1", "execution_time": 0.007013082504272461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_decreasing_window_function_test_rolling_sum_decreasing__idx__date_col__True.1c67e8ae47"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.303479Z", "completed_at": "2022-04-04T13:59:53.308874Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.309279Z", "completed_at": "2022-04-04T13:59:53.309288Z"}], "thread_id": "Thread-1", "execution_time": 0.006822824478149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_window_function_test_rolling_sum_increasing__idx__date_col__True.996e133dc9"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.310713Z", "completed_at": "2022-04-04T13:59:53.316437Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.316956Z", "completed_at": "2022-04-04T13:59:53.316968Z"}], "thread_id": "Thread-1", "execution_time": 0.007399797439575195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day.79cb16c1eb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.318890Z", "completed_at": "2022-04-04T13:59:53.350507Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.350904Z", "completed_at": "2022-04-04T13:59:53.350914Z"}], "thread_id": "Thread-1", "execution_time": 0.03345298767089844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_datetime__date___dbt_expectations_type_datetime_.a431470019"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.352968Z", "completed_at": "2022-04-04T13:59:53.385295Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.385695Z", "completed_at": "2022-04-04T13:59:53.385705Z"}], "thread_id": "Thread-1", "execution_time": 0.03428387641906738, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_day__date___dbt_expectations_type_timestamp_.79af0ea1f3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.387794Z", "completed_at": "2022-04-04T13:59:53.418233Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.418632Z", "completed_at": "2022-04-04T13:59:53.418643Z"}], "thread_id": "Thread-1", "execution_time": 0.032346248626708984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_date_timestamp__date___dbt_expectations_type_timestamp_.4fc8b3eb42"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.420692Z", "completed_at": "2022-04-04T13:59:53.427095Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.427490Z", "completed_at": "2022-04-04T13:59:53.427500Z"}], "thread_id": "Thread-1", "execution_time": 0.007745027542114258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_increasing_timeseries_data_date_day__date_day.b349b0a845"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.428864Z", "completed_at": "2022-04-04T13:59:53.436647Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.437051Z", "completed_at": "2022-04-04T13:59:53.437061Z"}], "thread_id": "Thread-1", "execution_time": 0.009056806564331055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_row_value__date_day__6__True.86019a24d0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.438477Z", "completed_at": "2022-04-04T13:59:53.443184Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.443576Z", "completed_at": "2022-04-04T13:59:53.443585Z"}], "thread_id": "Thread-1", "execution_time": 0.005988121032714844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_stdevs_timeseries_data_row_value__6.be239e407d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.444946Z", "completed_at": "2022-04-04T13:59:53.467151Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.467578Z", "completed_at": "2022-04-04T13:59:53.467589Z"}], "thread_id": "Thread-1", "execution_time": 0.023998022079467773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day.910ac3a171"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.469477Z", "completed_at": "2022-04-04T13:59:53.490248Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.490677Z", "completed_at": "2022-04-04T13:59:53.490688Z"}], "thread_id": "Thread-1", "execution_time": 0.022609233856201172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_date_day__day__not_date_day_2021_10_19_.39ae519ce7"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.492582Z", "completed_at": "2022-04-04T13:59:53.499490Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.499883Z", "completed_at": "2022-04-04T13:59:53.499891Z"}], "thread_id": "Thread-1", "execution_time": 0.008131027221679688, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_datetime__day__1.29c33143be"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.501252Z", "completed_at": "2022-04-04T13:59:53.508392Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.508800Z", "completed_at": "2022-04-04T13:59:53.508810Z"}], "thread_id": "Thread-1", "execution_time": 0.008419036865234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_day__day__1.9222375acc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.510196Z", "completed_at": "2022-04-04T13:59:53.517123Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.517517Z", "completed_at": "2022-04-04T13:59:53.517526Z"}], "thread_id": "Thread-1", "execution_time": 0.008170843124389648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_date_timestamp__day__1.300ccbdad1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.518874Z", "completed_at": "2022-04-04T13:59:53.551070Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.551485Z", "completed_at": "2022-04-04T13:59:53.551496Z"}], "thread_id": "Thread-1", "execution_time": 0.0339970588684082, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_date_day__date_datetime__date_timestamp__row_value__row_value_log.fea981f1fa"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.553409Z", "completed_at": "2022-04-04T13:59:53.561400Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.561798Z", "completed_at": "2022-04-04T13:59:53.561807Z"}], "thread_id": "Thread-1", "execution_time": 0.009256839752197266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_be_greater_than_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___1.ab45a07e5c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.563184Z", "completed_at": "2022-04-04T13:59:53.569521Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.569912Z", "completed_at": "2022-04-04T13:59:53.569921Z"}], "thread_id": "Thread-1", "execution_time": 0.0075778961181640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__date_day__ref_timeseries_data_extended_.668a389f21"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.571365Z", "completed_at": "2022-04-04T13:59:53.577246Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.577694Z", "completed_at": "2022-04-04T13:59:53.577704Z"}], "thread_id": "Thread-1", "execution_time": 0.007205963134765625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_other_table_timeseries_data_date_day__ref_timeseries_data_extended_.6fd6f4ea6b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.579141Z", "completed_at": "2022-04-04T13:59:53.585779Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.586176Z", "completed_at": "2022-04-04T13:59:53.586186Z"}], "thread_id": "Thread-1", "execution_time": 0.007911205291748047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_distinct_count_to_equal_timeseries_data_extended_row_value__date_day_dbt_date_yesterday___10.633f73d315"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.587556Z", "completed_at": "2022-04-04T13:59:53.619801Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.620256Z", "completed_at": "2022-04-04T13:59:53.620270Z"}], "thread_id": "Thread-1", "execution_time": 0.0343480110168457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_data_extended_date_day__date___dbt_expectations_type_datetime_.64544aba59"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.622396Z", "completed_at": "2022-04-04T13:59:53.651166Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.651571Z", "completed_at": "2022-04-04T13:59:53.651581Z"}], "thread_id": "Thread-1", "execution_time": 0.030546903610229492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_data_extended_date_day___dbt_expectations_type_datetime_.3377fc291f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.653505Z", "completed_at": "2022-04-04T13:59:53.661544Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.661947Z", "completed_at": "2022-04-04T13:59:53.661956Z"}], "thread_id": "Thread-1", "execution_time": 0.00932002067565918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_data_extended_row_value_log__cast_date_day_as_dbt_expectations_type_datetime___6__False.91749cfd51"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.663340Z", "completed_at": "2022-04-04T13:59:53.683534Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.683934Z", "completed_at": "2022-04-04T13:59:53.683944Z"}], "thread_id": "Thread-1", "execution_time": 0.021947145462036133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day.fef2d1f342"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.685811Z", "completed_at": "2022-04-04T13:59:53.705798Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.706215Z", "completed_at": "2022-04-04T13:59:53.706226Z"}], "thread_id": "Thread-1", "execution_time": 0.021764039993286133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_data_extended_date_day__day__7.e436a78560"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.708085Z", "completed_at": "2022-04-04T13:59:53.715204Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.715616Z", "completed_at": "2022-04-04T13:59:53.715626Z"}], "thread_id": "Thread-1", "execution_time": 0.008385658264160156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_data_extended_date_day__day__1.918ff17d7d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.717047Z", "completed_at": "2022-04-04T13:59:53.746324Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.746854Z", "completed_at": "2022-04-04T13:59:53.746867Z"}], "thread_id": "Thread-1", "execution_time": 0.03133678436279297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_columns_to_match_ordered_list_timeseries_data_extended_date_day__row_value__row_value_log.c4fbe0bb2c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.748912Z", "completed_at": "2022-04-04T13:59:53.757103Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.757505Z", "completed_at": "2022-04-04T13:59:53.757515Z"}], "thread_id": "Thread-1", "execution_time": 0.00945901870727539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__date_day.75413a8781"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.758871Z", "completed_at": "2022-04-04T13:59:53.766392Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.766804Z", "completed_at": "2022-04-04T13:59:53.766814Z"}], "thread_id": "Thread-1", "execution_time": 0.008800268173217773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__1__group_id_4__date_day.eb518be9a8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.768213Z", "completed_at": "2022-04-04T13:59:53.775562Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.775959Z", "completed_at": "2022-04-04T13:59:53.775968Z"}], "thread_id": "Thread-1", "execution_time": 0.008617162704467773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_grouped_row_values_to_have_recent_data_timeseries_data_grouped_day__group_id__row_value__1__date_day.53695446a8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.777342Z", "completed_at": "2022-04-04T13:59:53.782590Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.782981Z", "completed_at": "2022-04-04T13:59:53.782989Z"}], "thread_id": "Thread-1", "execution_time": 0.006498098373413086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_10.d82948f3e6"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.784338Z", "completed_at": "2022-04-04T13:59:53.790112Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.790519Z", "completed_at": "2022-04-04T13:59:53.790529Z"}], "thread_id": "Thread-1", "execution_time": 0.007050037384033203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_date_day__10.28ef2972b1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.791905Z", "completed_at": "2022-04-04T13:59:53.798874Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.799270Z", "completed_at": "2022-04-04T13:59:53.799279Z"}], "thread_id": "Thread-1", "execution_time": 0.00822591781616211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_table_row_count_to_be_between_timeseries_data_grouped_group_id__10000__True.1370954d9b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.800684Z", "completed_at": "2022-04-04T13:59:53.829528Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.829955Z", "completed_at": "2022-04-04T13:59:53.829966Z"}], "thread_id": "Thread-1", "execution_time": 0.030699968338012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_in_type_list_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.e2af5fe244"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.831929Z", "completed_at": "2022-04-04T13:59:53.860549Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.860972Z", "completed_at": "2022-04-04T13:59:53.860983Z"}], "thread_id": "Thread-1", "execution_time": 0.030498027801513672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_of_type_timeseries_hourly_data_extended_date_hour___dbt_expectations_type_datetime_.fa9ac6d2a4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.862994Z", "completed_at": "2022-04-04T13:59:53.871859Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.872278Z", "completed_at": "2022-04-04T13:59:53.872289Z"}], "thread_id": "Thread-1", "execution_time": 0.010190010070800781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_column_values_to_be_within_n_moving_stdevs_timeseries_hourly_data_extended_row_value_log__cast_date_hour_as_dbt_expectations_type_datetime___hour__6__False__12__48.c200505cc1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.873709Z", "completed_at": "2022-04-04T13:59:53.894793Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.895197Z", "completed_at": "2022-04-04T13:59:53.895208Z"}], "thread_id": "Thread-1", "execution_time": 0.022849082946777344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_data_for_every_n_datepart_timeseries_hourly_data_extended_date_hour__hour.5afac62404"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-04-04T13:59:53.897078Z", "completed_at": "2022-04-04T13:59:53.904292Z"}, {"name": "execute", "started_at": "2022-04-04T13:59:53.904685Z", "completed_at": "2022-04-04T13:59:53.904693Z"}], "thread_id": "Thread-1", "execution_time": 0.008460044860839844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_expectations_integration_tests.dbt_expectations_expect_row_values_to_have_recent_data_timeseries_hourly_data_extended_date_hour__hour__24.a182297cd8"}], "elapsed_time": 1.9208459854125977, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/claus/.dbt", "send_anonymous_usage_stats": false, "event_buffer_size": 100000, "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file diff --git a/dbt_packages/dbt_expectations/expectations.gif b/dbt_packages/dbt_expectations/expectations.gif new file mode 100644 index 0000000..4163d16 Binary files /dev/null and b/dbt_packages/dbt_expectations/expectations.gif differ diff --git a/dbt_packages/dbt_expectations/integration_tests/ci/profiles.yml b/dbt_packages/dbt_expectations/integration_tests/ci/profiles.yml new file mode 100644 index 0000000..4afff7f --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/ci/profiles.yml @@ -0,0 +1,36 @@ +config: + send_anonymous_usage_stats: False + use_colors: True + +integration_tests: + outputs: + postgres: + type: postgres + host: "{{ env_var('POSTGRES_HOST') }}" + user: "{{ env_var('POSTGRES_TEST_USER') }}" + pass: "{{ env_var('POSTGRES_TEST_PASSWORD') }}" + port: "{{ env_var('POSTGRES_TEST_PORT') | as_number }}" + dbname: "{{ env_var('POSTGRES_TEST_DATABASE') }}" + schema: dbt_utils_integration_tests_postgres + threads: 5 + + bigquery: + type: bigquery + method: service-account + keyfile: "{{ env_var('BIGQUERY_SERVICE_KEY_PATH') }}" + project: "{{ env_var('BIGQUERY_TEST_DATABASE') }}" + schema: "{{ env_var('BIGQUERY_TEST_SCHEMA') }}" + threads: 10 + + snowflake: + type: snowflake + account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}" + user: "{{ env_var('SNOWFLAKE_TEST_USER') }}" + password: "{{ env_var('SNOWFLAKE_TEST_PASSWORD') }}" + role: "{{ env_var('SNOWFLAKE_TEST_ROLE') }}" + database: "{{ env_var('SNOWFLAKE_TEST_DATABASE') }}" + warehouse: "{{ env_var('SNOWFLAKE_TEST_WAREHOUSE') }}" + schema: "{{ env_var('SNOWFLAKE_TEST_SCHEMA') }}" + threads: 10 + + target: postgres diff --git a/dbt_packages/dbt_expectations/integration_tests/dbt_project.yml b/dbt_packages/dbt_expectations/integration_tests/dbt_project.yml new file mode 100644 index 0000000..5da295b --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/dbt_project.yml @@ -0,0 +1,34 @@ + +name: 'dbt_expectations_integration_tests' +version: '1.0' + +profile: 'integration_tests' + +config-version: 2 + +model-paths: ["models"] +analysis-paths: ["analysis"] +test-paths: ["tests"] +seed-paths: ["data"] +macro-paths: ["macros"] + +target-path: "target" +clean-targets: ["target", "dbt_modules", "dbt_packages"] + +dispatch: + - macro_namespace: dbt_expectations + search_order: ['dbt_expectations_integration_tests', 'dbt_expectations'] + - macro_namespace: dbt_utils + search_order: ['dbt_expectations', 'dbt_utils'] +vars: + 'dbt_date:time_zone': 'America/Los_Angeles' + +quoting: + database: false + identifier: false + schema: false + +models: + dbt_expectations_integration_tests: + +schema: dbt_expectations_integration_tests + +materialized: table diff --git a/dbt_packages/dbt_expectations/integration_tests/macros/get_custom_schema.sql b/dbt_packages/dbt_expectations/integration_tests/macros/get_custom_schema.sql new file mode 100644 index 0000000..c1dee32 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/macros/get_custom_schema.sql @@ -0,0 +1,14 @@ +{% macro generate_schema_name(custom_schema_name, node) -%} + + {%- set default_schema = target.schema -%} + {%- if custom_schema_name is none -%} + + {{ default_schema }} + + {%- else -%} + + {{ custom_schema_name | trim }} + + {%- endif -%} + +{%- endmacro %} diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test.sql new file mode 100644 index 0000000..d1d8bbf --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test.sql @@ -0,0 +1,41 @@ +select + 1 as idx, + '2020-10-21' as date_col, + cast(0 as {{ dbt_utils.type_float() }}) as col_numeric_a, + cast(1 as {{ dbt_utils.type_float() }}) as col_numeric_b, + 'a' as col_string_a, + 'b' as col_string_b, + cast(null as {{ dbt_utils.type_string() }}) as col_null + +union all + +select + 2 as idx, + '2020-10-22' as date_col, + 1 as col_numeric_a, + 0 as col_numeric_b, + 'b' as col_string_a, + 'ab' as col_string_b, + null as col_null + +union all + +select + 3 as idx, + '2020-10-23' as date_col, + 0.5 as col_numeric_a, + 0.5 as col_numeric_b, + 'c' as col_string_a, + 'abc' as col_string_b, + null as col_null + +union all + +select + 4 as idx, + '2020-10-23' as date_col, + 0.5 as col_numeric_a, + 0.5 as col_numeric_b, + 'c' as col_string_a, + 'abcd' as col_string_b, + null as col_null diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test_factored.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test_factored.sql new file mode 100644 index 0000000..7496150 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/data_test_factored.sql @@ -0,0 +1 @@ +{{ dbt_utils.generate_series(upper_bound=8) }} diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/emails.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/emails.sql new file mode 100644 index 0000000..53b95a0 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/emails.sql @@ -0,0 +1,21 @@ +select + 'ab@gmail.com' as email_address, + '@[^.]*' as reg_exp + +union all + +select + 'ab@mail.com' as email_address, + '@[^.]*' as reg_exp + +union all + +select + 'abc@gmail.com' as email_address, + '@[^.]*' as reg_exp + +union all + +select + 'abc.com@gmail.com' as email_address, + '@[^.]*' as reg_exp diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/schema.yml b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/schema.yml new file mode 100644 index 0000000..08a4575 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/schema.yml @@ -0,0 +1,395 @@ +version: 2 +models: + - name: emails + columns: + - name: email_address + tests: + - dbt_expectations.expect_column_values_to_match_regex: + regex: "@[^.]*" + - dbt_expectations.expect_column_values_to_not_match_regex: + regex: "&[^.]*" + - dbt_expectations.expect_column_values_to_match_regex_list: + regex_list: ["@[^.]*", "&[^.]*"] + - dbt_expectations.expect_column_values_to_not_match_regex_list: + regex_list: ["@[^.]*", "&[^.]*"] + - dbt_expectations.expect_column_values_to_match_like_pattern: + like_pattern: "%@%" + - dbt_expectations.expect_column_values_to_not_match_like_pattern: + like_pattern: "%&%" + - dbt_expectations.expect_column_values_to_match_like_pattern_list: + like_pattern_list: ["%@%", "%&%"] + - dbt_expectations.expect_column_values_to_not_match_like_pattern_list: + like_pattern_list: ["%@%", "%&%"] + + + - name: timeseries_data + tests: + - dbt_expectations.expect_table_columns_to_match_ordered_list: + column_list: ["date_day", "date_datetime", "date_timestamp", "row_value", "row_value_log"] + - dbt_expectations.expect_column_distinct_count_to_equal_other_table: + column_name: date_day + compare_model: ref("timeseries_data_extended") + compare_column_name: date_day + - dbt_expectations.expect_column_distinct_count_to_equal_other_table: + column_name: date_day + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + exclusion_condition: not(date_day = '2021-10-19') + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + test_start_date: '{{ modules.datetime.date.today() - modules.datetime.timedelta(365) }}' + test_end_date: '{{ modules.datetime.date.today() - modules.datetime.timedelta(2) }}' + + + columns: + - name: date_day + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: [date, "{{ dbt_expectations.type_timestamp() }}"] + - dbt_expectations.expect_column_values_to_be_increasing: + sort_column: date_day + - dbt_expectations.expect_column_distinct_count_to_equal_other_table: + compare_model: ref("timeseries_data_extended") + + - name: date_datetime + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: [date, "{{ dbt_expectations.type_datetime() }}"] + + - name: date_timestamp + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: [date, "{{ dbt_expectations.type_timestamp() }}"] + + - name: row_value + tests: + - dbt_expectations.expect_column_values_to_be_within_n_stdevs: + sigma_threshold: 6 + - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs: + date_column_name: date_day + sigma_threshold: 6 + take_logs: true + severity: warn + - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs: + date_column_name: date_day + sigma_threshold: 6 + take_diffs: false + take_logs: true + severity: warn + + - name: timeseries_data_extended + tests: + - dbt_expectations.expect_table_columns_to_match_ordered_list: + column_list: ["date_day", "row_value", "row_value_log"] + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_day + date_part: day + interval: 7 + + columns: + - name: date_day + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 + + - dbt_expectations.expect_column_values_to_be_of_type: + column_type: "{{ dbt_expectations.type_datetime() }}" + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: [date, "{{ dbt_expectations.type_datetime() }}"] + + - name: row_value + tests: + - dbt_expectations.expect_column_distinct_count_to_equal: + row_condition: date_day = {{ dbt_date.yesterday() }} + value: 10 + - dbt_expectations.expect_column_distinct_count_to_be_greater_than: + row_condition: date_day = {{ dbt_date.yesterday() }} + value: 1 + + + - name: row_value_log + tests: + - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs: + date_column_name: cast(date_day as {{ dbt_expectations.type_datetime() }}) + sigma_threshold: 6 + take_logs: false + severity: warn + + - name: timeseries_hourly_data_extended + tests: + - dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart: + date_col: date_hour + date_part: hour + + columns: + - name: date_hour + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: hour + interval: 24 + - dbt_expectations.expect_column_values_to_be_of_type: + column_type: "{{ dbt_expectations.type_datetime() }}" + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: ["{{ dbt_expectations.type_datetime() }}"] + + + - name: row_value_log + tests: + - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs: + date_column_name: cast(date_hour as {{ dbt_expectations.type_datetime() }}) + period: hour + trend_periods: 48 + test_periods: 12 + sigma_threshold: 6 + take_logs: false + severity: warn + + + - name: data_test + tests: + - dbt_expectations.expect_compound_columns_to_be_unique: + column_list: ["date_col", "col_string_b"] + - dbt_expectations.expect_compound_columns_to_be_unique: + column_list: ["date_col", "col_string_b"] + row_condition: 2=2 + - dbt_expectations.expect_compound_columns_to_be_unique: + column_list: ["date_col", "col_string_b"] + ignore_row_if: "any_value_is_missing" + - dbt_expectations.expect_compound_columns_to_be_unique: + column_list: ["date_col", "col_string_b"] + ignore_row_if: "all_values_are_missing" + - dbt_expectations.expect_table_row_count_to_equal: + value: 4 + - dbt_expectations.expect_table_row_count_to_be_between: + min_value: 1 + max_value: 4 + - dbt_expectations.expect_table_row_count_to_be_between: + min_value: 1 + - dbt_expectations.expect_table_row_count_to_be_between: + max_value: 4 + - dbt_expectations.expect_table_row_count_to_equal_other_table: + compare_model: ref("data_test") + row_condition: 1=1 + compare_row_condition: 1=1 + - dbt_expectations.expect_table_column_count_to_equal: + value: 7 + - dbt_expectations.expect_table_column_count_to_be_between: + min_value: 1 + max_value: 10 + - dbt_expectations.expect_table_column_count_to_be_between: + min_value: 1 + - dbt_expectations.expect_table_column_count_to_be_between: + max_value: 10 + - dbt_expectations.expect_table_columns_to_contain_set: + column_list: ["col_numeric_b", "col_string_a"] + - dbt_expectations.expect_table_columns_to_match_set: + column_list: ["idx", "date_col", "col_numeric_a", "col_numeric_b", "col_string_a", "col_string_b", "col_null"] + - dbt_expectations.expect_table_columns_to_match_ordered_list: + column_list: ["idx", "date_col", "col_numeric_a", "col_numeric_b", "col_string_a", "col_string_b", "col_null"] + - dbt_expectations.expect_table_column_count_to_equal_other_table: + compare_model: ref("data_test") + - dbt_expectations.expect_table_columns_to_not_contain_set: + column_list: ["col_numeric_c", "col_string_d"] + - dbt_expectations.expression_is_true: + expression: (col_numeric_a + col_numeric_b = 1) + - dbt_expectations.equal_expression: + expression: sum(col_numeric_a) + compare_model: ref("data_test") + group_by: [idx] + - dbt_expectations.equal_expression: + expression: sum(col_numeric_a) + compare_expression: sum(col_numeric_a * .5) + compare_model: ref("data_test") + group_by: [idx] + tolerance_percent: .5 + - dbt_expectations.expect_column_pair_values_to_be_in_set: + column_A: col_numeric_a + column_B: col_numeric_b + value_pairs_set: [[0, 1], [1, 0], [0.5, 0.5], [0.5, 0.5]] + - dbt_expectations.equal_expression: + expression: sum(col_numeric_a) + compare_model: ref("data_test") + compare_expression: sum(col_numeric_b) + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: col_numeric_a+10 + column_B: col_numeric_a + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: col_numeric_a + column_B: col_numeric_a + or_equal: True + - dbt_expectations.expect_column_pair_values_to_be_equal: + column_A: col_numeric_a + column_B: col_numeric_a + - dbt_expectations.expect_select_column_values_to_be_unique_within_record: + column_list: ["col_string_a", "col_string_b"] + ignore_row_if: "any_value_is_missing" + - dbt_expectations.expect_multicolumn_sum_to_equal: + column_list: ["col_numeric_a", "col_numeric_b"] + sum_total: 4 + + + + columns: + - name: idx + tests: + - dbt_expectations.expect_column_to_exist: + column_index: 1 + - dbt_expectations.expect_column_values_to_be_unique + - dbt_expectations.expect_column_values_to_be_increasing: + sort_column: idx + + - name: col_numeric_a + tests: + - dbt_expectations.expect_column_to_exist + - dbt_expectations.expect_column_to_exist: + column_index: 3 + - dbt_expectations.expect_column_values_to_not_be_null + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + max_value: 1 + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + - dbt_expectations.expect_column_sum_to_be_between: + min_value: 1 + max_value: 3 + - dbt_expectations.expect_column_min_to_be_between: + min_value: 0 + max_value: 0 + - dbt_expectations.expect_column_max_to_be_between: + min_value: 1 + max_value: 1 + - dbt_expectations.expect_column_mean_to_be_between: + min_value: 0 + max_value: 1.5 + - dbt_expectations.expect_column_unique_value_count_to_be_between: + min_value: 3 + max_value: 3 + - dbt_expectations.expect_column_proportion_of_unique_values_to_be_between: + min_value: 0 + max_value: .75 + - dbt_expectations.expect_column_stdev_to_be_between: + min_value: 0 + max_value: 2 + - dbt_expectations.expect_column_stdev_to_be_between: + min_value: 0 + strictly: true + - dbt_expectations.expect_column_most_common_value_to_be_in_set: + value_set: [0.5] + top_n: 1 + - dbt_expectations.expect_column_values_to_be_increasing: + sort_column: col_numeric_a + strictly: false + + + - name: col_string_a + tests: + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: ['a', 'b', 'c'] + quote_values: true + - dbt_expectations.expect_column_values_to_not_be_in_set: + value_set: ['2','3'] + quote_values: true + - dbt_expectations.expect_column_distinct_values_to_equal_set: + value_set: ['a','b','c','c'] + quote_values: true + - dbt_expectations.expect_column_distinct_values_to_be_in_set: + value_set: ['a','b','c','d'] + quote_values: true + - dbt_expectations.expect_column_distinct_values_to_contain_set: + value_set: ['a','b'] + quote_values: true + - dbt_expectations.expect_column_value_lengths_to_equal: + value: 1 + - dbt_expectations.expect_column_values_to_have_consistent_casing + - dbt_expectations.expect_column_values_to_have_consistent_casing: + display_inconsistent_columns: true + + - name: col_string_b + tests: + - dbt_expectations.expect_column_values_to_not_be_in_set: + value_set: ['a','c'] + quote_values: true + - dbt_expectations.expect_column_value_lengths_to_be_between: + min_value: 1 + max_value: 4 + - dbt_expectations.expect_column_value_lengths_to_be_between: + min_value: 1 + - dbt_expectations.expect_column_value_lengths_to_be_between: + max_value: 4 + + - name: col_null + tests: + - dbt_expectations.expect_column_values_to_be_null + + - name : data_test_factored + tests : + - dbt_expectations.expect_table_row_count_to_equal_other_table_times_factor: + compare_model: ref("data_test") + factor: 2 + + - name : timeseries_data_grouped + tests : + - dbt_expectations.expect_table_row_count_to_be_between: + min_value: 10 + - dbt_expectations.expect_table_row_count_to_be_between: + min_value: 10 + group_by: [date_day] + - dbt_expectations.expect_table_row_count_to_be_between: + max_value: 10000 + group_by: [group_id] + strictly: True + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id] + timestamp_column: date_day + datepart: day + interval: 1 + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id, row_value] + timestamp_column: date_day + datepart: day + interval: 1 + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id] + timestamp_column: date_day + datepart: day + interval: 1 + row_condition: group_id = 4 + - dbt_expectations.expect_grouped_row_values_to_have_recent_data: + group_by: [group_id] + timestamp_column: date_timestamp + datepart: day + interval: 1 + + - name: window_function_test + columns: + - name: rolling_sum_increasing + tests : + - dbt_expectations.expect_column_values_to_be_increasing: + group_by: ['idx'] + strictly: true + sort_column: date_col + + - name: rolling_sum_decreasing + tests : + - dbt_expectations.expect_column_values_to_be_decreasing: + group_by: ['idx'] + strictly: true + sort_column: date_col diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_10.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_10.sql new file mode 100644 index 0000000..5b4cd9b --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_10.sql @@ -0,0 +1 @@ +{{ dbt_utils.generate_series(upper_bound=10) }} \ No newline at end of file diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_4.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_4.sql new file mode 100644 index 0000000..1c092da --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/series_4.sql @@ -0,0 +1 @@ +{{ dbt_utils.generate_series(upper_bound=4) }} \ No newline at end of file diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_base.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_base.sql new file mode 100644 index 0000000..0fa9919 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_base.sql @@ -0,0 +1 @@ +{{ dbt_date.get_base_dates(n_dateparts=366, datepart='day') }} diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data.sql new file mode 100644 index 0000000..454a1bc --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data.sql @@ -0,0 +1,28 @@ +with dates as ( + + select * from {{ ref('timeseries_base') }} + +), +add_row_values as ( + + select + d.date_day, + cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_datetime, + cast(d.date_day as {{ dbt_utils.type_timestamp() }}) as date_timestamp, + cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value + from + dates d + +), +add_logs as ( + + select + *, + {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log + from + add_row_values +) +select + * +from + add_logs diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_extended.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_extended.sql new file mode 100644 index 0000000..73d6b06 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_extended.sql @@ -0,0 +1,31 @@ +with dates as ( + + select * from {{ ref('timeseries_base') }} + +), +row_values as ( + select * from {{ ref('series_10') }} +), +add_row_values as ( + + select + cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_day, + cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value + from + dates d + cross join + row_values r + +), +add_logs as ( + + select + *, + {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log + from + add_row_values +) +select + * +from + add_logs diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_grouped.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_grouped.sql new file mode 100644 index 0000000..876bc85 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_data_grouped.sql @@ -0,0 +1,36 @@ +with dates as ( + select * from {{ ref('timeseries_base') }} +), +groupings as ( + select * from {{ ref('series_4') }} +), +row_values as ( + select * from {{ ref('series_10') }} +), +add_row_values as ( + + select + cast(d.date_day as {{ dbt_expectations.type_datetime() }}) as date_day, + cast(d.date_day as {{ dbt_expectations.type_timestamp() }}) as date_timestamp, + cast(g.generated_number as {{ dbt_utils.type_int() }}) as group_id, + cast(floor(100 * r.generated_number) as {{ dbt_utils.type_int() }}) as row_value + from + dates d + cross join + groupings g + cross join + row_values r + +), +add_logs as ( + + select + *, + {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log + from + add_row_values +) +select + * +from + add_logs diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly.sql new file mode 100644 index 0000000..aeb0cec --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly.sql @@ -0,0 +1,4 @@ +{{ dbt_utils.date_spine('hour', + start_date=dbt_date.n_days_ago(10), + end_date=dbt_date.tomorrow() + ) }} diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly_data_extended.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly_data_extended.sql new file mode 100644 index 0000000..e6180ec --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/timeseries_hourly_data_extended.sql @@ -0,0 +1,31 @@ +with dates as ( + + select * from {{ ref('timeseries_hourly') }} + +), +row_values as ( + select * from {{ ref('series_10') }} +), +add_row_values as ( + + select + cast(d.date_hour as {{ dbt_expectations.type_datetime() }}) as date_hour, + cast(abs({{ dbt_expectations.rand() }}) as {{ dbt_utils.type_float() }}) as row_value + from + dates d + cross join + row_values r + +), +add_logs as ( + + select + *, + {{ dbt_expectations.log_natural('nullif(row_value, 0)') }} as row_value_log + from + add_row_values +) +select + * +from + add_logs diff --git a/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/window_function_test.sql b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/window_function_test.sql new file mode 100644 index 0000000..e5280b2 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/models/schema_tests/window_function_test.sql @@ -0,0 +1,48 @@ +with data_example as ( + + select + 1 as idx, + '2020-10-21' as date_col, + cast(0 as {{ dbt_utils.type_float() }}) as col_numeric_a + + union all + + select + 2 as idx, + '2020-10-22' as date_col, + 1 as col_numeric_a + + union all + + select + 2 as idx, + '2020-10-23' as date_col, + 2 as col_numeric_a + + union all + + select + 2 as idx, + '2020-10-24' as date_col, + 1 as col_numeric_a + + union all + + select + 3 as idx, + '2020-10-23' as date_col, + 0.5 as col_numeric_a + union all + + select + 4 as idx, + '2020-10-23' as date_col, + 0.5 as col_numeric_a + +) +select + *, + sum(col_numeric_a) over (partition by idx order by date_col) as rolling_sum_increasing, + sum(col_numeric_a) over (partition by idx order by date_col desc) as rolling_sum_decreasing +from + data_example diff --git a/dbt_packages/dbt_expectations/integration_tests/packages.yml b/dbt_packages/dbt_expectations/integration_tests/packages.yml new file mode 100644 index 0000000..424d083 --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/packages.yml @@ -0,0 +1,2 @@ +packages: + - local: ../ diff --git a/dbt_packages/dbt_expectations/integration_tests/test.sh b/dbt_packages/dbt_expectations/integration_tests/test.sh new file mode 100644 index 0000000..790660c --- /dev/null +++ b/dbt_packages/dbt_expectations/integration_tests/test.sh @@ -0,0 +1,14 @@ +if [[ $# -gt 0 ]] +then + +i=1; +for t in "$@" +do + + dbt build -t $t + +done + +else + echo "Please specify one or more targets as command-line arguments, i.e. test.sh bq snowflake" +fi diff --git a/dbt_packages/dbt_expectations/macros/.gitkeep b/dbt_packages/dbt_expectations/macros/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_expectations/macros/math/log_natural.sql b/dbt_packages/dbt_expectations/macros/math/log_natural.sql new file mode 100644 index 0000000..b34587c --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/math/log_natural.sql @@ -0,0 +1,21 @@ +{% macro log_natural(x) -%} + {{ adapter.dispatch('log_natural', 'dbt_expectations') (x) }} +{% endmacro %} + +{% macro default__log_natural(x) %} + + ln({{ x }}) + +{%- endmacro -%} + +{% macro bigquery__log_natural(x) %} + + ln({{ x }}) + +{%- endmacro -%} + +{% macro snowflake__log_natural(x) %} + + ln({{ x }}) + +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/math/median.sql b/dbt_packages/dbt_expectations/macros/math/median.sql new file mode 100644 index 0000000..f20fbf6 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/math/median.sql @@ -0,0 +1,3 @@ +{% macro median(field) %} +{{ dbt_expectations.percentile_cont(field, 0.5) }} +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/math/percentile_cont.sql b/dbt_packages/dbt_expectations/macros/math/percentile_cont.sql new file mode 100644 index 0000000..a41b1e5 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/math/percentile_cont.sql @@ -0,0 +1,13 @@ +{% macro percentile_cont(field, quantile, partition=None) %} + {{ adapter.dispatch('quantile', 'dbt_expectations') (field, quantile, partition) }} +{% endmacro %} + +{% macro default__quantile(field, quantile, partition) -%} + percentile_cont({{ quantile }}) within group (order by {{ field }}) + {%- if partition %}over(partition by {{ partition }}){% endif -%} +{%- endmacro %} + +{% macro bigquery__quantile(field, quantile, partition) %} + percentile_cont({{ field }}, {{ quantile }}) + over({%- if partition %}partition by {{ partition }}{% endif -%}) +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/math/rand.sql b/dbt_packages/dbt_expectations/macros/math/rand.sql new file mode 100644 index 0000000..b808297 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/math/rand.sql @@ -0,0 +1,33 @@ +{% macro rand() -%} + {{ adapter.dispatch('rand', 'dbt_expectations') () }} +{% endmacro %} + +{% macro default__rand() %} + + rand() + +{%- endmacro -%} + +{% macro bigquery__rand() %} + + rand() + +{%- endmacro -%} + +{% macro snowflake__rand(seed) %} + + uniform(0::float, 1::float, random()) + +{%- endmacro -%} + +{% macro postgres__rand() %} + + random() + +{%- endmacro -%} + +{% macro redshift__rand() %} + + random() + +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql b/dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql new file mode 100644 index 0000000..e223a33 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/regex/regexp_instr.sql @@ -0,0 +1,24 @@ +{% macro regexp_instr(source_value, regexp, position=1, occurrence=1) %} + + {{ adapter.dispatch('regexp_instr', 'dbt_expectations')( + source_value, regexp, position, occurrence + ) }} + +{% endmacro %} + +{% macro default__regexp_instr(source_value, regexp, position, occurrence) %} +regexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }}) +{% endmacro %} + +{% macro redshift__regexp_instr(source_value, regexp, position, occurrence) %} +regexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }}) +{% endmacro %} + +{% macro postgres__regexp_instr(source_value, regexp, position, occurrence) %} +array_length((select regexp_matches({{ source_value }}, '{{ regexp }}')), 1) +{% endmacro %} + + +{% macro spark__regexp_instr(source_value, regexp, position, occurrence) %} +case when {{ source_value }} rlike '{{ regexp }}' then 1 else 0 end +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/_truth_expression.sql b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/_truth_expression.sql new file mode 100644 index 0000000..94be171 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/_truth_expression.sql @@ -0,0 +1,8 @@ + +{% macro truth_expression(expression) %} + {{ adapter.dispatch('truth_expression', 'dbt_expectations') (expression) }} +{% endmacro %} + +{% macro default__truth_expression(expression) %} + {{ expression }} as expression +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/equal_expression.sql b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/equal_expression.sql new file mode 100644 index 0000000..31d343d --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/equal_expression.sql @@ -0,0 +1,110 @@ +{% macro get_select(model, expression, row_condition, group_by) -%} + {{ adapter.dispatch('get_select', 'dbt_expectations') (model, expression, row_condition, group_by) }} +{%- endmacro %} + +{%- macro default__get_select(model, expression, row_condition, group_by) %} + select + {% if group_by %} + {% for g in group_by -%} + {{ g }} as col_{{ loop.index }}, + {% endfor -%} + {% endif %} + {{ expression }} as expression + from + {{ model }} + {%- if row_condition %} + where + {{ row_condition }} + {% endif %} + {% if group_by %} + group by + {% for g in group_by -%} + {{ loop.index }}{% if not loop.last %},{% endif %} + {% endfor %} + {% endif %} +{% endmacro -%} + + +{% test equal_expression(model, expression, + compare_model=None, + compare_expression=None, + group_by=None, + compare_group_by=None, + row_condition=None, + compare_row_condition=None, + tolerance=0.0, + tolerance_percent=None + ) -%} + + {{ adapter.dispatch('test_equal_expression', 'dbt_expectations') ( + model, + expression, + compare_model, + compare_expression, + group_by, + compare_group_by, + row_condition, + compare_row_condition, + tolerance, + tolerance_percent) }} +{%- endtest %} + +{%- macro default__test_equal_expression( + model, + expression, + compare_model, + compare_expression, + group_by, + compare_group_by, + row_condition, + compare_row_condition, + tolerance, + tolerance_percent) -%} + + {%- set compare_model = model if not compare_model else compare_model -%} + {%- set compare_expression = expression if not compare_expression else compare_expression -%} + {%- set compare_row_condition = row_condition if not compare_row_condition else compare_row_condition -%} + {%- set compare_group_by = group_by if not compare_group_by else compare_group_by -%} + + {%- set n_cols = (group_by|length) if group_by else 0 %} + with a as ( + {{ dbt_expectations.get_select(model, expression, row_condition, group_by) }} + ), + b as ( + {{ dbt_expectations.get_select(compare_model, compare_expression, compare_row_condition, compare_group_by) }} + ), + final as ( + + select + {% for i in range(1, n_cols + 1) -%} + coalesce(a.col_{{ i }}, b.col_{{ i }}) as col_{{ i }}, + {% endfor %} + a.expression, + b.expression as compare_expression, + abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference, + abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/ + nullif(a.expression * 1.0, 0) as expression_difference_percent + from + {% if n_cols > 0 %} + a + full outer join + b on + {% for i in range(1, n_cols + 1) -%} + a.col_{{ i }} = b.col_{{ i }} {% if not loop.last %}and{% endif %} + {% endfor -%} + {% else %} + a cross join b + {% endif %} + ) + -- DEBUG: + -- select * from final + select + * + from final + where + {% if tolerance_percent %} + expression_difference_percent > {{ tolerance_percent }} + {% else %} + expression_difference > {{ tolerance }} + {% endif %} +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_between.sql new file mode 100644 index 0000000..42a3315 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_between.sql @@ -0,0 +1,44 @@ +{% test expression_between(model, + expression, + min_value=None, + max_value=None, + group_by_columns=None, + row_condition=None, + strictly=False + ) %} + + {{ dbt_expectations.expression_between(model, expression, min_value, max_value, group_by_columns, row_condition, strictly) }} + +{% endtest %} + +{% macro expression_between(model, + expression, + min_value, + max_value, + group_by_columns, + row_condition, + strictly + ) %} + +{%- if min_value is none and max_value is none -%} +{{ exceptions.raise_compiler_error( + "You have to provide either a min_value, max_value or both." +) }} +{%- endif -%} + +{%- set strict_operator = "" if strictly else "=" -%} + +{% set expression_min_max %} +( 1=1 +{%- if min_value is not none %} and {{ expression | trim }} >{{ strict_operator }} {{ min_value }}{% endif %} +{%- if max_value is not none %} and {{ expression | trim }} <{{ strict_operator }} {{ max_value }}{% endif %} +) +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression_min_max, + group_by_columns=group_by_columns, + row_condition=row_condition) + }} + +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_is_true.sql b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_is_true.sql new file mode 100644 index 0000000..c21cda8 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/_generalized/expression_is_true.sql @@ -0,0 +1,58 @@ +{% test expression_is_true(model, + expression, + test_condition="= true", + group_by_columns=None, + row_condition=None + ) %} + + {{ dbt_expectations.expression_is_true(model, expression, test_condition, group_by_columns, row_condition) }} + +{% endtest %} + +{% macro expression_is_true(model, + expression, + test_condition="= true", + group_by_columns=None, + row_condition=None + ) %} + {{ adapter.dispatch('expression_is_true', 'dbt_expectations') (model, expression, test_condition, group_by_columns, row_condition) }} +{%- endmacro %} + +{% macro default__expression_is_true(model, expression, test_condition, group_by_columns, row_condition) -%} +with grouped_expression as ( + select + {% if group_by_columns %} + {% for group_by_column in group_by_columns -%} + {{ group_by_column }} as col_{{ loop.index }}, + {% endfor -%} + {% endif %} + {{ dbt_expectations.truth_expression(expression) }} + from {{ model }} + {%- if row_condition %} + where + {{ row_condition }} + {% endif %} + {% if group_by_columns %} + group by + {% for group_by_column in group_by_columns -%} + {{ group_by_column }}{% if not loop.last %},{% endif %} + {% endfor %} + {% endif %} + +), +validation_errors as ( + + select + * + from + grouped_expression + where + not(expression {{ test_condition }}) + +) + +select * +from validation_errors + + +{% endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql new file mode 100644 index 0000000..2942569 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql @@ -0,0 +1,16 @@ +{% test expect_column_distinct_count_to_be_greater_than(model, + column_name, + value, + quote_values=False, + group_by=None, + row_condition=None + ) %} +{% set expression %} +count(distinct {{ column_name }}) > {{ value }} +{% endset %} +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=group_by, + row_condition=row_condition) + }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql new file mode 100644 index 0000000..e479c9a --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql @@ -0,0 +1,16 @@ +{% test expect_column_distinct_count_to_equal(model, + column_name, + value, + quote_values=False, + group_by=None, + row_condition=None + ) %} +{% set expression %} +count(distinct {{ column_name }}) = {{ value }} +{% endset %} +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=group_by, + row_condition=row_condition) + }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql new file mode 100644 index 0000000..0a21b65 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql @@ -0,0 +1,26 @@ +{% test expect_column_distinct_count_to_equal_other_table(model, + compare_model, + column_name, + compare_column_name, + row_condition=None, + compare_row_condition=None + ) %} +{%- set expression -%} +count(distinct {{ column_name }}) +{%- endset -%} +{%- set compare_expression -%} +{%- if compare_column_name -%} +count(distinct {{ compare_column_name }}) +{%- else -%} +{{ expression }} +{%- endif -%} +{%- endset -%} +{{ dbt_expectations.test_equal_expression( + model, + expression=expression, + compare_model=compare_model, + compare_expression=compare_expression, + row_condition=row_condition, + compare_row_condition=compare_row_condition +) }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql new file mode 100644 index 0000000..03a3c8c --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql @@ -0,0 +1,54 @@ +{% test expect_column_distinct_values_to_be_in_set(model, column_name, + value_set, + quote_values=False, + row_condition=None + ) %} + +with all_values as ( + + select distinct + {{ column_name }} as value_field + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + '{{ value }}' + {%- else -%} + {{ value }} + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} + +), +unique_set_values as ( + + select distinct value_field + from + set_values + +), +validation_errors as ( + -- values from the model that are not in the set + select + v.value_field + from + all_values v + left join + unique_set_values s on v.value_field = s.value_field + where + s.value_field is null + +) + +select * +from validation_errors + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql new file mode 100644 index 0000000..57987f0 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql @@ -0,0 +1,54 @@ +{% test expect_column_distinct_values_to_contain_set(model, column_name, + value_set, + quote_values=True, + row_condition=None + ) %} + +with all_values as ( + + select distinct + {{ column_name }} as value_field + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + '{{ value }}' + {%- else -%} + {{ value }} + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} + +), +unique_set_values as ( + + select distinct value_field + from + set_values + +), +validation_errors as ( + -- values in set that are not in the list of values from the model + select + s.value_field + from + unique_set_values s + left join + all_values v on s.value_field = v.value_field + where + v.value_field is null + +) + +select * +from validation_errors + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql new file mode 100644 index 0000000..7a3e03a --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql @@ -0,0 +1,55 @@ +{% test expect_column_distinct_values_to_equal_set(model, column_name, + value_set, + quote_values=True, + row_condition=None + ) %} + +with all_values as ( + + select distinct + {{ column_name }} as column_value + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + '{{ value }}' + {%- else -%} + {{ value }} + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} + +), +unique_set_values as ( + + select distinct value_field + from + set_values + +), +validation_errors as ( + + select + * + from + all_values v + full outer join + unique_set_values s on v.column_value = s.value_field + where + v.column_value is null or + s.value_field is null + +) + +select * +from validation_errors + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql new file mode 100644 index 0000000..dad56b7 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql @@ -0,0 +1,19 @@ +{% test expect_column_max_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +max({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql new file mode 100644 index 0000000..5700058 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql @@ -0,0 +1,19 @@ +{% test expect_column_mean_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +avg({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql new file mode 100644 index 0000000..6cc3ef8 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql @@ -0,0 +1,20 @@ +{% test expect_column_median_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} + +{% set expression %} +{{ dbt_expectations.median(column_name) }} +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql new file mode 100644 index 0000000..e77df36 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql @@ -0,0 +1,20 @@ +{% test expect_column_min_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +min({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql new file mode 100644 index 0000000..a435e1a --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql @@ -0,0 +1,94 @@ +{% test expect_column_most_common_value_to_be_in_set(model, column_name, + value_set, + top_n, + quote_values=False, + data_type="decimal", + row_condition=None + ) -%} + {{ adapter.dispatch('test_expect_column_most_common_value_to_be_in_set', 'dbt_expectations') (model, column_name, value_set, top_n, quote_values, data_type, row_condition) }} +{%- endtest %} + +{% macro default__test_expect_column_most_common_value_to_be_in_set(model, column_name, + value_set, + top_n, + quote_values, + data_type, + row_condition + ) %} + +with value_counts as ( + + select + {% if quote_values -%} + {{ column_name }} + {%- else -%} + cast({{ column_name }} as {{ data_type }}) + {%- endif %} as value_field, + count(*) as value_count + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + + group by {% if quote_values -%} + {{ column_name }} + {%- else -%} + cast({{ column_name }} as {{ data_type }}) + {%- endif %} + +), +value_counts_ranked as ( + + select + *, + row_number() over(order by value_count desc) as value_count_rank + from + value_counts + +), +value_count_top_n as ( + + select + value_field + from + value_counts_ranked + where + value_count_rank = {{ top_n }} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + '{{ value }}' + {%- else -%} + cast({{ value }} as {{ data_type }}) + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} + +), +unique_set_values as ( + + select distinct value_field + from + set_values + +), +validation_errors as ( + -- values from the model that are not in the set + select + value_field + from + value_count_top_n + where + value_field not in (select value_field from unique_set_values) + +) + +select * +from validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql new file mode 100644 index 0000000..09e0608 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql @@ -0,0 +1,20 @@ +{% test expect_column_proportion_of_unique_values_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +count(distinct {{ column_name }})/count({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql new file mode 100644 index 0000000..35ef8e8 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql @@ -0,0 +1,21 @@ +{% test expect_column_quantile_values_to_be_between(model, column_name, + quantile, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} + +{% set expression %} +{{ dbt_expectations.percentile_cont(column_name, quantile) }} +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql new file mode 100644 index 0000000..582340e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql @@ -0,0 +1,38 @@ +{% test expect_column_stdev_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) -%} + {{ adapter.dispatch('test_expect_column_stdev_to_be_between', 'dbt_expectations') ( + model, column_name, + min_value, + max_value, + group_by, + row_condition, + strictly + ) }} +{%- endtest %} + +{% macro default__test_expect_column_stdev_to_be_between( + model, column_name, + min_value, + max_value, + group_by, + row_condition, + strictly + ) %} + +{% set expression %} +stddev({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql new file mode 100644 index 0000000..afc200f --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql @@ -0,0 +1,19 @@ +{% test expect_column_sum_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +sum({{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql new file mode 100644 index 0000000..546985c --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql @@ -0,0 +1,19 @@ +{% test expect_column_unique_value_count_to_be_between(model, column_name, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +count(distinct {{ column_name }}) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql new file mode 100644 index 0000000..911b6a6 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql @@ -0,0 +1,22 @@ +{% test expect_column_values_to_be_between(model, column_name, + min_value=None, + max_value=None, + row_condition=None, + strictly=False + ) %} + +{% set expression %} +{{ column_name }} +{% endset %} + +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=None, + row_condition=row_condition, + strictly=strictly + ) }} + + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql new file mode 100644 index 0000000..46060e9 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql @@ -0,0 +1,52 @@ +{% test expect_column_values_to_be_decreasing(model, column_name, + sort_column=None, + strictly=True, + row_condition=None, + group_by=None) %} + +{%- set sort_column = column_name if not sort_column else sort_column -%} +{%- set operator = "<" if strictly else "<=" %} +with all_values as ( + + select + {{ sort_column }} as sort_column, + {%- if group_by -%} + {{ group_by | join(", ") }}, + {%- endif %} + {{ column_name }} as value_field + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +add_lag_values as ( + + select + sort_column, + value_field, + lag(value_field) over + {%- if not group_by -%} + (order by sort_column) + {%- else -%} + (partition by {{ group_by | join(", ") }} order by sort_column) + {%- endif %} as value_field_lag + from + all_values + +), +validation_errors as ( + + select + * + from + add_lag_values + where + value_field_lag is not null + and + not (value_field {{ operator }} value_field_lag) + +) +select * +from validation_errors +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql new file mode 100644 index 0000000..17f954b --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql @@ -0,0 +1,46 @@ +{% test expect_column_values_to_be_in_set(model, column_name, + value_set, + quote_values=True, + row_condition=None + ) %} + +with all_values as ( + + select + {{ column_name }} as value_field + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + cast('{{ value }}' as {{ dbt_utils.type_string() }}) + {%- else -%} + {{ value }} + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} +), +validation_errors as ( + -- values from the model that are not in the set + select + v.value_field + from + all_values v + left join + set_values s on v.value_field = s.value_field + where + s.value_field is null + +) + +select * +from validation_errors + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql new file mode 100644 index 0000000..491a625 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql @@ -0,0 +1,32 @@ +{%- test expect_column_values_to_be_in_type_list(model, column_name, column_type_list) -%} +{%- if execute -%} + + {%- set column_name = column_name | upper -%} + {%- set columns_in_relation = adapter.get_columns_in_relation(model) -%} + {%- set column_type_list = column_type_list| map("upper") | list -%} + with relation_columns as ( + + {% for column in columns_in_relation %} + select + cast('{{ column.name | upper }}' as {{ dbt_utils.type_string() }}) as relation_column, + cast('{{ column.dtype | upper }}' as {{ dbt_utils.type_string() }}) as relation_column_type + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), + test_data as ( + + select + * + from + relation_columns + where + relation_column = '{{ column_name }}' + and + relation_column_type not in ('{{ column_type_list | join("', '") }}') + + ) + select * + from test_data + +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql new file mode 100644 index 0000000..6750d92 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql @@ -0,0 +1,54 @@ +{% test expect_column_values_to_be_increasing(model, column_name, + sort_column=None, + strictly=True, + row_condition=None, + group_by=None) %} + +{%- set sort_column = column_name if not sort_column else sort_column -%} +{%- set operator = ">" if strictly else ">=" -%} +with all_values as ( + + select + {{ sort_column }} as sort_column, + {%- if group_by -%} + {{ group_by | join(", ") }}, + {%- endif %} + {{ column_name }} as value_field + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +add_lag_values as ( + + select + sort_column, + {%- if group_by -%} + {{ group_by | join(", ") }}, + {%- endif %} + value_field, + lag(value_field) over + {%- if not group_by -%} + (order by sort_column) + {%- else -%} + (partition by {{ group_by | join(", ") }} order by sort_column) + {%- endif %} as value_field_lag + from + all_values + +), +validation_errors as ( + select + * + from + add_lag_values + where + value_field_lag is not null + and + not (value_field {{ operator }} value_field_lag) + +) +select * +from validation_errors +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql new file mode 100644 index 0000000..dc4b1a3 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql @@ -0,0 +1,11 @@ +{% test expect_column_values_to_be_null(model, column_name, row_condition=None) %} + +{% set expression = column_name ~ " is null" %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql new file mode 100644 index 0000000..170a896 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql @@ -0,0 +1,4 @@ +{%- test expect_column_values_to_be_of_type(model, column_name, column_type) -%} +{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(model, column_name, [column_type]) }} +{%- endtest -%} + diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql new file mode 100644 index 0000000..a3626bd --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql @@ -0,0 +1,3 @@ +{% test expect_column_values_to_be_unique(model, column_name, row_condition=None) %} +{{ dbt_expectations.test_expect_compound_columns_to_be_unique(model, [column_name], row_condition=row_condition) }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql new file mode 100644 index 0000000..1007150 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql @@ -0,0 +1,41 @@ +{% test expect_column_values_to_have_consistent_casing(model, column_name, display_inconsistent_columns=False) %} + +with test_data as ( + + select + distinct {{ column_name }} as distinct_values + from + {{ model }} + + ), + {% if display_inconsistent_columns %} + validation_errors as ( + + select + lower(distinct_values) as inconsistent_columns, + count(distinct_values) as set_count_case_insensitive + from + test_data + group by 1 + having + count(distinct_values) > 1 + + ) + select * from validation_errors + {% else %} + validation_errors as ( + + select + count(1) as set_count, + count(distinct lower(distinct_values)) as set_count_case_insensitive + from + test_data + + ) + select * + from + validation_errors + where + set_count != set_count_case_insensitive + {% endif %} + {%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql new file mode 100644 index 0000000..515efca --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql @@ -0,0 +1,44 @@ +{% test expect_column_values_to_not_be_in_set(model, column_name, + value_set, + quote_values=True, + row_condition=None + ) %} + +with all_values as ( + + select + {{ column_name }} as value_field + + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + +), +set_values as ( + + {% for value in value_set -%} + select + {% if quote_values -%} + cast('{{ value }}' as {{ dbt_utils.type_string() }}) + {%- else -%} + {{ value }} + {%- endif %} as value_field + {% if not loop.last %}union all{% endif %} + {% endfor %} +), +validation_errors as ( + -- values from the model that match the set + select + v.value_field + from + all_values v + join + set_values s on v.value_field = s.value_field + +) + +select * +from validation_errors + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql new file mode 100644 index 0000000..d820169 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql @@ -0,0 +1,11 @@ +{% test expect_column_values_to_not_be_null(model, column_name, row_condition=None) %} + +{% set expression = column_name ~ " is not null" %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql new file mode 100644 index 0000000..42894f0 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql @@ -0,0 +1,142 @@ +{%- macro _get_metric_expression(metric_column, take_logs) -%} + +{%- if take_logs %} +{%- set expr = "nullif(" ~ metric_column ~ ", 0)" -%} +coalesce({{ dbt_expectations.log_natural(expr) }}, 0) +{%- else -%} +coalesce({{ metric_column }}, 0) +{%- endif %} + +{%- endmacro -%} + +{% test expect_column_values_to_be_within_n_moving_stdevs(model, + column_name, + date_column_name, + period='day', + lookback_periods=1, + trend_periods=7, + test_periods=14, + sigma_threshold=3, + sigma_threshold_upper=None, + sigma_threshold_lower=None, + take_diffs=true, + take_logs=true + ) -%} + {{ adapter.dispatch('test_expect_column_values_to_be_within_n_moving_stdevs', 'dbt_expectations') (model, + column_name, + date_column_name, + period, + lookback_periods, + trend_periods, + test_periods, + sigma_threshold, + sigma_threshold_upper, + sigma_threshold_lower, + take_diffs, + take_logs + ) }} +{%- endtest %} + +{% macro default__test_expect_column_values_to_be_within_n_moving_stdevs(model, + column_name, + date_column_name, + period, + lookback_periods, + trend_periods, + test_periods, + sigma_threshold, + sigma_threshold_upper, + sigma_threshold_lower, + take_diffs, + take_logs + ) %} + +{%- set sigma_threshold_upper = sigma_threshold_upper if sigma_threshold_upper else sigma_threshold -%} +{%- set sigma_threshold_lower = sigma_threshold_lower if sigma_threshold_lower else -1 * sigma_threshold -%} + +with metric_values as ( + + with grouped_metric_values as ( + + select + {{ dbt_utils.date_trunc(period, date_column_name) }} as metric_period, + sum({{ column_name }}) as agg_metric_value + from + {{ model }} + group by + 1 + + ) + {%- if take_diffs %} + , grouped_metric_values_with_priors as ( + + select + *, + lag(agg_metric_value, {{ lookback_periods }}) over(order by metric_period) as prior_agg_metric_value + from + grouped_metric_values d + + ) + select + *, + {{ dbt_expectations._get_metric_expression("agg_metric_value", take_logs) }} + - + {{ dbt_expectations._get_metric_expression("prior_agg_metric_value", take_logs) }} + as metric_test_value + from + grouped_metric_values_with_priors d + + {%- else %} + + select + *, + {{ dbt_expectations._get_metric_expression("agg_metric_value", take_logs) }} + as metric_test_value + from + grouped_metric_values + + {%- endif %} + +), +metric_moving_calcs as ( + + select + *, + avg(metric_test_value) + over(order by metric_period rows + between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_average, + stddev(metric_test_value) + over(order by metric_period rows + between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_stddev + from + metric_values + +), +metric_sigma as ( + + select + *, + (metric_test_value - metric_test_rolling_average) as metric_test_delta, + (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma + from + metric_moving_calcs + +) +select + * +from + metric_sigma +where + + metric_period >= cast( + {{ dbt_utils.dateadd(period, -test_periods, dbt_utils.date_trunc(period, dbt_date.now())) }} + as {{ dbt_utils.type_timestamp() }}) + and + metric_period < {{ dbt_utils.date_trunc(period, dbt_date.now()) }} + and + + not ( + metric_test_sigma >= {{ sigma_threshold_lower }} and + metric_test_sigma <= {{ sigma_threshold_upper }} + ) +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql new file mode 100644 index 0000000..a32e2bf --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql @@ -0,0 +1,57 @@ +{% test expect_column_values_to_be_within_n_stdevs(model, + column_name, + group_by=None, + sigma_threshold=3 + ) -%} + {{ adapter.dispatch('test_expect_column_values_to_be_within_n_stdevs', 'dbt_expectations') (model, column_name, group_by, sigma_threshold) }} +{%- endtest %} + +{% macro default__test_expect_column_values_to_be_within_n_stdevs(model, + column_name, + group_by, + sigma_threshold + ) %} +with metric_values as ( + + {% if group_by -%} + select + {{ group_by }} as metric_date, + sum({{ column_name }}) as {{ column_name }} + from + {{ model }} + group by + 1 + {%- else -%} + select + {{ column_name }} as {{ column_name }} + from + {{ model }} + {%- endif %} + +), +metric_values_with_statistics as ( + + select + *, + avg({{ column_name }}) over() as {{ column_name }}_average, + stddev({{ column_name }}) over() as {{ column_name }}_stddev + from + metric_values + +), +metric_values_z_scores as ( + + select + *, + ({{ column_name }} - {{ column_name }}_average)/{{ column_name }}_stddev as {{ column_name }}_sigma + from + metric_values_with_statistics + +) +select + * +from + metric_values_z_scores +where + abs({{ column_name }}_sigma) > {{ sigma_threshold }} +{%- endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql new file mode 100644 index 0000000..029917e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql @@ -0,0 +1,123 @@ +{%- test expect_row_values_to_have_data_for_every_n_datepart(model, + date_col, + date_part="day", + interval=None, + row_condition=None, + exclusion_condition=None, + test_start_date=None, + test_end_date=None) -%} +{% if not execute %} + {{ return('') }} +{% endif %} + +{% if not test_start_date or not test_end_date %} + {% set sql %} + + select + min({{ date_col }}) as start_{{ date_part }}, + max({{ date_col }}) as end_{{ date_part }} + from {{ model }} + {% if row_condition %} + where {{ row_condition }} + {% endif %} + + {% endset %} + + {%- set dr = run_query(sql) -%} + {%- set db_start_date = dr.columns[0].values()[0].strftime('%Y-%m-%d') -%} + {%- set db_end_date = dr.columns[1].values()[0].strftime('%Y-%m-%d') -%} + +{% endif %} + +{% if not test_start_date %} +{% set start_date = db_start_date %} +{% else %} +{% set start_date = test_start_date %} +{% endif %} + + +{% if not test_end_date %} +{% set end_date = db_end_date %} +{% else %} +{% set end_date = test_end_date %} +{% endif %} +with base_dates as ( + + {{ dbt_date.get_base_dates(start_date=start_date, end_date=end_date, datepart=date_part) }} + {% if interval %} + {# + Filter the date spine created above down to the interval granularity using a modulo operation. + The number of date_parts after the start_date divided by the integer interval will produce no remainder for the desired intervals, + e.g. for 2-day interval from a starting Jan 1, 2020: + params: start_date = '2020-01-01', date_part = 'day', interval = 2 + date spine created above: [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-04, 2020-01-05, ...] + The first parameter to the `mod` function would be the number of days between the start_date and the spine date, i.e. [0, 1, 2, 3, 4 ...] + The second parameter to the `mod` function would be the integer interval, i.e. 2 + This modulo operation produces the following remainders: [0, 1, 0, 1, 0, ...] + Filtering the spine only where this remainder == 0 will return a spine with every other day as desired, i.e. [2020-01-01, 2020-01-03, 2020-01-05, ...] + #} + where mod( + cast({{ dbt_utils.datediff("'" ~ start_date ~ "'", 'date_' ~ date_part, date_part) }} as {{ dbt_utils.type_int() }}), + cast({{interval}} as {{ dbt_utils.type_int() }}) + ) = 0 + {% endif %} + +), +model_data as ( + + select + {% if not interval %} + + cast({{ dbt_utils.date_trunc(date_part, date_col) }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }}, + + {% else %} + {# + Use a modulo operator to determine the number of intervals that a date_col is away from the interval-date spine + and subtracts that amount to effectively slice each date_col record into its corresponding spine bucket, + e.g. given a date_col of with records [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-11, 2020-01-12] + if we want to slice these dates into their 2-day buckets starting Jan 1, 2020 (start_date = '2020-01-01', date_part='day', interval=2), + the modulo operation described above will produce these remainders: [0, 1, 0, 0, 1] + subtracting that number of days from the observations will produce records [2020-01-01, 2020-01-01, 2020-01-03, 2020-01-11, 2020-01-11], + all of which align with records from the interval-date spine + #} + {{dbt_utils.dateadd( + date_part, + "mod( + cast(" ~ dbt_utils.datediff("'" ~ start_date ~ "'", date_col, date_part) ~ " as " ~ dbt_utils.type_int() ~ " ), + cast(" ~ interval ~ " as " ~ dbt_utils.type_int() ~ " ) + ) * (-1)", + "cast( " ~ dbt_utils.date_trunc(date_part, date_col) ~ " as " ~ dbt_expectations.type_datetime() ~ ")" + )}} as date_{{ date_part }}, + + {% endif %} + + count(*) as row_cnt + from + {{ model }} f + {% if row_condition %} + where {{ row_condition }} + {% endif %} + group by + date_{{date_part}} + +), + +final as ( + + select + cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }}, + case when f.date_{{ date_part }} is null then true else false end as is_missing, + coalesce(f.row_cnt, 0) as row_cnt + from + base_dates d + left join + model_data f on cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) = f.date_{{ date_part }} +) +select + * +from final +where row_cnt = 0 +{% if exclusion_condition %} + and {{ exclusion_condition }} +{% endif %} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql new file mode 100644 index 0000000..474f26e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql @@ -0,0 +1,19 @@ + +{% test expect_column_pair_values_A_to_be_greater_than_B(model, + column_A, + column_B, + or_equal=False, + row_condition=None + ) %} + +{% set operator = ">=" if or_equal else ">" %} +{% set expression = column_A ~ " " ~ operator ~ " " ~ column_B %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql new file mode 100644 index 0000000..5fb4bcb --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql @@ -0,0 +1,18 @@ + +{% test expect_column_pair_values_to_be_equal(model, + column_A, + column_B, + row_condition=None + ) %} + +{% set operator = "=" %} +{% set expression = column_A ~ " " ~ operator ~ " " ~ column_B %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql new file mode 100644 index 0000000..a0d7d92 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql @@ -0,0 +1,27 @@ +{% test expect_column_pair_values_to_be_in_set(model, + column_A, + column_B, + value_pairs_set, + row_condition=None + ) %} + +{% set expression %} +{% for pair in value_pairs_set %} +{%- if (pair | length) == 2 %} +({{ column_A }} = {{ pair[0] }} and {{ column_B }} = {{ pair[1] }}){% if not loop.last %} or {% endif %} +{% else %} +{{ exceptions.raise_compiler_error( + "`value_pairs_set` argument for expect_column_pair_values_to_be_in_set test cannot have more than 2 item per element. + Got: '" ~ pair ~ "'.'" + ) }} +{% endif %} +{% endfor %} +{% endset %} +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql new file mode 100644 index 0000000..d6f3eda --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql @@ -0,0 +1,69 @@ +{% test expect_compound_columns_to_be_unique(model, + column_list, + quote_columns=False, + ignore_row_if="all_values_are_missing", + row_condition=None + ) %} +{% if not column_list %} + {{ exceptions.raise_compiler_error( + "`column_list` must be specified as a list of columns. Got: '" ~ column_list ~"'.'" + ) }} +{% endif %} +{% if not quote_columns %} + {%- set columns=column_list %} +{% elif quote_columns %} + {%- set columns=[] %} + {% for column in column_list -%} + {% set columns = columns.append( adapter.quote(column) ) %} + {%- endfor %} +{% else %} + {{ exceptions.raise_compiler_error( + "`quote_columns` argument for expect_compound_columns_to_be_unique test must be one of [True, False] Got: '" ~ quote_columns ~"'.'" + ) }} +{% endif %} + +{%- set row_condition_ext -%} + +{%- if row_condition %} + {{ row_condition }} and +{% endif -%} + +{%- if ignore_row_if == "all_values_are_missing" %} + ( + {% for column in columns -%} + {{ column }} is not null{% if not loop.last %} and {% endif %} + {% endfor %} + ) +{%- elif ignore_row_if == "any_value_is_missing" %} + ( + {% for column in columns -%} + {{ column }} is not null{% if not loop.last %} or {% endif %} + {% endfor %} + ) +{%- endif -%} +{%- endset -%} + +with validation_errors as ( + + select + {% for column in columns -%} + {{ column }}{% if not loop.last %},{% endif %} + {%- endfor %} + from {{ model }} + where + 1=1 + {%- if row_condition_ext %} + and {{ row_condition_ext }} + {% endif %} + group by + {% for column in columns -%} + {{ column }}{% if not loop.last %},{% endif %} + {%- endfor %} + having count(*) > 1 + +) +select * from validation_errors +{% endtest %} + + + diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql new file mode 100644 index 0000000..884e01f --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql @@ -0,0 +1,22 @@ + +{% test expect_multicolumn_sum_to_equal(model, + column_list, + sum_total, + group_by=None, + row_condition=None + ) %} + +{% set expression %} +{% for column in column_list %} +sum({{ column }}){% if not loop.last %} + {% endif %} +{% endfor %} = {{ sum_total }} +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=group_by, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql new file mode 100644 index 0000000..c2ed4b5 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql @@ -0,0 +1,77 @@ +{% test expect_select_column_values_to_be_unique_within_record(model, + column_list, + quote_columns=False, + ignore_row_if="all_values_are_missing", + row_condition=None + ) -%} + {{ adapter.dispatch('test_expect_select_column_values_to_be_unique_within_record', 'dbt_expectations') (model, column_list, quote_columns, ignore_row_if, row_condition) }} +{%- endtest %} + +{% macro default__test_expect_select_column_values_to_be_unique_within_record(model, + column_list, + quote_columns, + ignore_row_if, + row_condition + ) %} + +{% if not quote_columns %} + {%- set columns=column_list %} +{% elif quote_columns %} + {%- set columns=[] %} + {% for column in column_list -%} + {% set columns = columns.append( adapter.quote(column) ) %} + {%- endfor %} +{% else %} + {{ exceptions.raise_compiler_error( + "`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '" ~ quote_columns ~"'.'" + ) }} +{% endif %} + +with column_values as ( + + select + row_number() over(order by 1) as row_index, + {% for column in columns -%} + {{ column }}{% if not loop.last %},{% endif %} + {%- endfor %} + from {{ model }} + where 1=1 + {% if row_condition %} + and {{ row_condition }} + {% endif %} + {% if ignore_row_if == "all_values_are_missing" %} + and + ( + {% for column in columns -%} + {{ column }} is not null{% if not loop.last %} and {% endif %} + {%- endfor %} + ) + {% elif ignore_row_if == "any_value_is_missing" %} + and + ( + {% for column in columns -%} + {{ column }} is not null{% if not loop.last %} or {% endif %} + {%- endfor %} + ) + {% endif %} + +), +unpivot_columns as ( + + {% for column in columns %} + select row_index, '{{ column }}' as column_name, {{ column }} as column_value from column_values + {% if not loop.last %}union all{% endif %} + {% endfor %} +), +validation_errors as ( + + select + row_index, + count(distinct column_value) as column_values + from unpivot_columns + group by 1 + having count(distinct column_value) < {{ columns | length }} + +) +select * from validation_errors +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/_get_like_pattern_expression.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/_get_like_pattern_expression.sql new file mode 100644 index 0000000..91e9421 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/_get_like_pattern_expression.sql @@ -0,0 +1,4 @@ + +{% macro _get_like_pattern_expression(column_name, like_pattern, positive) %} +{{ column_name }} {{ "not" if not positive else "" }} like '{{ like_pattern }}' +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql new file mode 100644 index 0000000..8ae4898 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql @@ -0,0 +1,20 @@ +{% test expect_column_value_lengths_to_be_between(model, column_name, + min_value=None, + max_value=None, + row_condition=None, + strictly=False + ) %} +{% set expression %} +{{ dbt_utils.length(column_name) }} +{% endset %} + +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=None, + row_condition=row_condition, + strictly=strictly + ) }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql new file mode 100644 index 0000000..9359940 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql @@ -0,0 +1,15 @@ +{% test expect_column_value_lengths_to_equal(model, column_name, + value, + row_condition=None + ) %} + +{% set expression = dbt_utils.length(column_name) ~ " = " ~ value %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql new file mode 100644 index 0000000..f54e056 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql @@ -0,0 +1,15 @@ +{% test expect_column_values_to_match_like_pattern(model, column_name, + like_pattern, + row_condition=None + ) %} + +{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql new file mode 100644 index 0000000..c0697fd --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql @@ -0,0 +1,23 @@ +{% test expect_column_values_to_match_like_pattern_list(model, column_name, + like_pattern_list, + match_on="any", + row_condition=None + ) %} + +{% set expression %} + {% for like_pattern in like_pattern_list %} + {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) }} + {%- if not loop.last %} + {{ " and " if match_on == "all" else " or "}} + {% endif -%} + {% endfor %} +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql new file mode 100644 index 0000000..3a3fa98 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql @@ -0,0 +1,17 @@ +{% test expect_column_values_to_match_regex(model, column_name, + regex, + row_condition=None + ) %} + +{% set expression %} +{{ dbt_expectations.regexp_instr(column_name, regex) }} > 0 +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql new file mode 100644 index 0000000..f6e0345 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql @@ -0,0 +1,23 @@ +{% test expect_column_values_to_match_regex_list(model, column_name, + regex_list, + match_on="any", + row_condition=None + ) %} + +{% set expression %} + {% for regex in regex_list %} + {{ dbt_expectations.regexp_instr(column_name, regex) }} > 0 + {%- if not loop.last %} + {{ " and " if match_on == "all" else " or "}} + {% endif -%} + {% endfor %} +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql new file mode 100644 index 0000000..f12c80e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql @@ -0,0 +1,15 @@ +{% test expect_column_values_to_not_match_like_pattern(model, column_name, + like_pattern, + row_condition=None + ) %} + +{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql new file mode 100644 index 0000000..2be1f15 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql @@ -0,0 +1,23 @@ +{% test expect_column_values_to_not_match_like_pattern_list(model, column_name, + like_pattern_list, + match_on="any", + row_condition=None + ) %} + +{% set expression %} + {% for like_pattern in like_pattern_list %} + {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) }} + {%- if not loop.last %} + {{ " and " if match_on == "all" else " or "}} + {% endif -%} + {% endfor %} +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql new file mode 100644 index 0000000..6a96872 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql @@ -0,0 +1,17 @@ +{% test expect_column_values_to_not_match_regex(model, column_name, + regex, + row_condition=None + ) %} + +{% set expression %} +{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0 +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql new file mode 100644 index 0000000..dba1c65 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql @@ -0,0 +1,23 @@ +{% test expect_column_values_to_not_match_regex_list(model, column_name, + regex_list, + match_on="any", + row_condition=None + ) %} + +{% set expression %} +{% for regex in regex_list %} +{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0 +{%- if not loop.last %} +{{ " and " if match_on == "all" else " or "}} +{% endif -%} +{% endfor %} +{% endset %} + +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=None, + row_condition=row_condition + ) + }} + +{% endtest %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_get_column_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_get_column_list.sql new file mode 100644 index 0000000..21b0305 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_get_column_list.sql @@ -0,0 +1,5 @@ +{%- macro _get_column_list(model, transform="upper") -%} +{%- set relation_columns = adapter.get_columns_in_relation(model) -%} +{%- set relation_column_names = relation_columns | map(attribute="name") | map(transform) | list -%} +{%- do return(relation_column_names) -%} +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_list_intersect.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_list_intersect.sql new file mode 100644 index 0000000..67ea29e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/_list_intersect.sql @@ -0,0 +1,10 @@ + +{%- macro _list_intersect(list1, list2) -%} +{%- set matching_items = [] -%} +{%- for itm in list1 -%} + {%- if itm in list2 -%} + {%- do matching_items.append(itm) -%} + {%- endif -%} +{%- endfor -%} +{%- do return(matching_items) -%} +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_column_to_exist.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_column_to_exist.sql new file mode 100644 index 0000000..1cb244e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_column_to_exist.sql @@ -0,0 +1,35 @@ +{%- test expect_column_to_exist(model, column_name, column_index=None, transform="upper") -%} +{%- if execute -%} + + {%- set column_name = column_name | map(transform) | join -%} + {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%} + + {%- set matching_column_index = relation_column_names.index(column_name) if column_name in relation_column_names else -1 %} + + {%- if column_index -%} + + {%- set column_index_0 = column_index - 1 if column_index > 0 else 0 -%} + + {%- set column_index_matches = true if matching_column_index == column_index_0 else false %} + + {%- else -%} + + {%- set column_index_matches = true -%} + + {%- endif %} + + with test_data as ( + + select + cast('{{ column_name }}' as {{ dbt_utils.type_string() }}) as column_name, + {{ matching_column_index }} as matching_column_index, + {{ column_index_matches }} as column_index_matches + + ) + select * + from test_data + where + not(matching_column_index >= 0 and column_index_matches) + +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql new file mode 100644 index 0000000..f128f1c --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql @@ -0,0 +1,85 @@ +{% test expect_grouped_row_values_to_have_recent_data(model, + group_by, + timestamp_column, + datepart, + interval, + row_condition=None) %} + + {{ adapter.dispatch('test_expect_grouped_row_values_to_have_recent_data', 'dbt_expectations') (model, + group_by, + timestamp_column, + datepart, + interval, + row_condition) }} + +{% endtest %} + +{% macro default__test_expect_grouped_row_values_to_have_recent_data(model, + group_by, + timestamp_column, + datepart, + interval, + row_condition) %} +with latest_grouped_timestamps as ( + + select + {%- for g in group_by %} + {{ g }}, + {%- endfor %} + max(1) as join_key, + max(cast({{ timestamp_column }} as {{ dbt_utils.type_timestamp() }})) as latest_timestamp_column + from + {{ model }} + where + -- to exclude erroneous future dates + cast({{ timestamp_column }} as {{ dbt_utils.type_timestamp() }}) <= {{ dbt_date.now() }} + {% if row_condition %} + and {{ row_condition }} + {% endif %} + + {{ dbt_utils.group_by(group_by | length )}} + +), +total_row_counts as ( + + select + max(1) as join_key, + count(*) as row_count + from + latest_grouped_timestamps + +), +outdated_grouped_timestamps as ( + + select * + from + latest_grouped_timestamps + where + -- are the max timestamps per group older than the specified cutoff? + latest_timestamp_column < + cast( + {{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }} + as {{ dbt_utils.type_timestamp() }} + ) + +), +validation_errors as ( + + select + r.row_count, + t.* + from + total_row_counts r + left join + outdated_grouped_timestamps t + on r.join_key = t.join_key + where + -- fail if either no rows were returned due to row_condition, + -- or the recency test returned failed rows + r.row_count = 0 + or + t.join_key is not null + +) +select * from validation_errors +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql new file mode 100644 index 0000000..f428685 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql @@ -0,0 +1,40 @@ +{% test expect_row_values_to_have_recent_data(model, + column_name, + datepart, + interval, + row_condition=None) %} + + {{ adapter.dispatch('test_expect_row_values_to_have_recent_data', 'dbt_expectations') (model, + column_name, + datepart, + interval, + row_condition) }} + +{% endtest %} + +{% macro default__test_expect_row_values_to_have_recent_data(model, column_name, datepart, interval, row_condition) %} +{%- set default_start_date = '1970-01-01' -%} +with max_recency as ( + + select max(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})) as max_timestamp + from + {{ model }} + where + -- to exclude erroneous future dates + cast({{ column_name }} as {{ dbt_utils.type_timestamp() }}) <= {{ dbt_date.now() }} + {% if row_condition %} + and {{ row_condition }} + {% endif %} +) +select + * +from + max_recency +where + -- if the row_condition excludes all rows, we need to compare against a default date + -- to avoid false negatives + coalesce(max_timestamp, cast('{{ default_start_date }}' as {{ dbt_utils.type_timestamp() }})) + < + cast({{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }} as {{ dbt_utils.type_timestamp() }}) + +{% endmacro %} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql new file mode 100644 index 0000000..25449ba --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql @@ -0,0 +1,33 @@ +{%- test expect_table_column_count_to_be_between(model, + min_value=None, + max_value=None + ) -%} +{%- if min_value is none and max_value is none -%} +{{ exceptions.raise_compiler_error( + "You have to provide either a min_value, max_value or both." +) }} +{%- endif -%} +{%- if execute -%} +{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%} + +{%- set expression %} +( 1=1 +{%- if min_value %} and number_actual_columns >= min_value{% endif %} +{%- if max_value %} and number_actual_columns <= max_value{% endif %} +) +{% endset -%} + +with test_data as ( + + select + {{ number_actual_columns }} as number_actual_columns, + {{ min_value if min_value else 0 }} as min_value, + {{ max_value if max_value else 0 }} as max_value + +) +select * +from test_data +where + not {{ expression }} +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql new file mode 100644 index 0000000..099f39c --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql @@ -0,0 +1,16 @@ +{%- test expect_table_column_count_to_equal(model, value) -%} +{%- if execute -%} +{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%} +with test_data as ( + + select + {{ number_actual_columns }} as number_actual_columns, + {{ value }} as value + +) +select * +from test_data +where + number_actual_columns != value +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql new file mode 100644 index 0000000..a88584e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql @@ -0,0 +1,17 @@ +{%- test expect_table_column_count_to_equal_other_table(model, compare_model) -%} +{%- if execute -%} +{%- set number_columns = (adapter.get_columns_in_relation(model) | length) -%} +{%- set compare_number_columns = (adapter.get_columns_in_relation(compare_model) | length) -%} +with test_data as ( + + select + {{ number_columns }} as number_columns, + {{ compare_number_columns }} as compare_number_columns + +) +select * +from test_data +where + number_columns != compare_number_columns +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql new file mode 100644 index 0000000..b49f0ca --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql @@ -0,0 +1,29 @@ +{%- test expect_table_columns_to_contain_set(model, column_list, transform="upper") -%} +{%- if execute -%} + {%- set column_list = column_list | map(transform) | list -%} + {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%} + {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%} + with relation_columns as ( + + {% for col_name in relation_column_names %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), + input_columns as ( + + {% for col_name in column_list %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ) + select * + from + input_columns i + left join + relation_columns r on r.relation_column = i.input_column + where + -- catch any column in input list that is not in the list of table columns + r.relation_column is null +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql new file mode 100644 index 0000000..f7eae49 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql @@ -0,0 +1,36 @@ +{%- test expect_table_columns_to_match_ordered_list(model, column_list, transform="upper") -%} +{%- if execute -%} + {%- set column_list = column_list | map(transform) | list -%} + {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%} + {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%} + with relation_columns as ( + + {% for col_name in relation_column_names %} + select + {{ loop.index }} as relation_column_idx, + cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), + input_columns as ( + + {% for col_name in column_list %} + select + {{ loop.index }} as input_column_idx, + cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ) + select * + from + relation_columns r + full outer join + input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx + where + -- catch any column in input list that is not in the sequence of table columns + -- or any table column that is not in the input sequence + r.relation_column is null or + i.input_column is null + +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql new file mode 100644 index 0000000..27c3f0e --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql @@ -0,0 +1,32 @@ +{%- test expect_table_columns_to_match_set(model, column_list, transform="upper") -%} +{%- if execute -%} + {%- set column_list = column_list | map(transform) | list -%} + {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%} + {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%} + with relation_columns as ( + + {% for col_name in relation_column_names %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), + input_columns as ( + + {% for col_name in column_list %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ) + select * + from + relation_columns r + full outer join + input_columns i on r.relation_column = i.input_column + where + -- catch any column in input list that is not in the list of table columns + -- or any table column that is not in the input list + r.relation_column is null or + i.input_column is null + +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql new file mode 100644 index 0000000..a6f3bea --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql @@ -0,0 +1,28 @@ +{%- test expect_table_columns_to_not_contain_set(model, column_list, transform="upper") -%} +{%- if execute -%} + {%- set column_list = column_list | map(transform) | list -%} + {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%} + {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%} + with relation_columns as ( + + {% for col_name in relation_column_names %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), + input_columns as ( + + {% for col_name in column_list %} + select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column + {% if not loop.last %}union all{% endif %} + {% endfor %} + ) + -- catch any column in input list that is in the list of table columns + select * + from + input_columns i + inner join + relation_columns r on r.relation_column = i.input_column + +{%- endif -%} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql new file mode 100644 index 0000000..c8917d5 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql @@ -0,0 +1,19 @@ +{%- test expect_table_row_count_to_be_between(model, + min_value=None, + max_value=None, + group_by=None, + row_condition=None, + strictly=False + ) -%} +{% set expression %} +count(*) +{% endset %} +{{ dbt_expectations.expression_between(model, + expression=expression, + min_value=min_value, + max_value=max_value, + group_by_columns=group_by, + row_condition=row_condition, + strictly=strictly + ) }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql new file mode 100644 index 0000000..50fb180 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql @@ -0,0 +1,29 @@ +{%- test expect_table_row_count_to_equal(model, + value, + group_by=None, + row_condition=None + ) -%} + {{ adapter.dispatch('test_expect_table_row_count_to_equal', + 'dbt_expectations') (model, + value, + group_by, + row_condition + ) }} +{% endtest %} + + + +{%- macro default__test_expect_table_row_count_to_equal(model, + value, + group_by, + row_condition + ) -%} +{% set expression %} +count(*) = {{ value }} +{% endset %} +{{ dbt_expectations.expression_is_true(model, + expression=expression, + group_by_columns=group_by, + row_condition=row_condition) + }} +{%- endmacro -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql new file mode 100644 index 0000000..052fd24 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql @@ -0,0 +1,8 @@ +{%- test expect_table_row_count_to_equal_other_table(model, compare_model, factor=1, row_condition=None, compare_row_condition=None) -%} +{{ dbt_expectations.test_equal_expression(model, "count(*)", + compare_model=compare_model, + compare_expression="count(*) * " + factor|string, + row_condition=row_condition, + compare_row_condition=compare_row_condition +) }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql new file mode 100644 index 0000000..f8519e3 --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql @@ -0,0 +1,7 @@ +{%- test expect_table_row_count_to_equal_other_table_times_factor(model, compare_model, factor, row_condition=None, compare_row_condition=None) -%} +{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table(model, compare_model, + factor=factor, + row_condition=row_condition, + compare_row_condition=compare_row_condition +) }} +{%- endtest -%} diff --git a/dbt_packages/dbt_expectations/macros/utils/datatypes.sql b/dbt_packages/dbt_expectations/macros/utils/datatypes.sql new file mode 100644 index 0000000..93fe83b --- /dev/null +++ b/dbt_packages/dbt_expectations/macros/utils/datatypes.sql @@ -0,0 +1,35 @@ +{# timestamp ------------------------------------------------- #} +{%- macro type_timestamp() -%} + {{ return(adapter.dispatch('type_timestamp', 'dbt_expectations')()) }} +{%- endmacro -%} + +{% macro default__type_timestamp() -%} + timestamp +{%- endmacro %} + +{% macro snowflake__type_timestamp() -%} + timestamp_ntz +{%- endmacro %} + +{% macro postgres__type_timestamp() -%} + timestamp without time zone +{%- endmacro %} + +{# datetime ------------------------------------------------- #} + +{% macro type_datetime() -%} + {{ return(adapter.dispatch('type_datetime', 'dbt_expectations')()) }} +{%- endmacro %} + +{% macro default__type_datetime() -%} + datetime +{%- endmacro %} + +{# see: https://docs.snowflake.com/en/sql-reference/data-types-datetime.html#datetime #} +{% macro snowflake__type_datetime() -%} + timestamp_ntz +{%- endmacro %} + +{% macro postgres__type_datetime() -%} + timestamp without time zone +{%- endmacro %} diff --git a/dbt_packages/dbt_expectations/packages.yml b/dbt_packages/dbt_expectations/packages.yml new file mode 100644 index 0000000..fa90cb4 --- /dev/null +++ b/dbt_packages/dbt_expectations/packages.yml @@ -0,0 +1,3 @@ +packages: + - package: calogica/dbt_date + version: [">=0.5.0", "<0.6.0"] diff --git a/dbt_packages/dbt_expectations/regen_docs.sh b/dbt_packages/dbt_expectations/regen_docs.sh new file mode 100644 index 0000000..d0dc34f --- /dev/null +++ b/dbt_packages/dbt_expectations/regen_docs.sh @@ -0,0 +1,10 @@ +git checkout -B docs-regen +cd integration_tests +dbt docs generate +mv -f target/*.json ../docs +mv -f target/*.html ../docs +git add . +git commit -am"updating docs site" +git push --set-upstream origin docs-regen +git checkout main +git branch -D docs-regen diff --git a/dbt_packages/dbt_expectations/tests/.gitkeep b/dbt_packages/dbt_expectations/tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_utils/.circleci/config.yml b/dbt_packages/dbt_utils/.circleci/config.yml new file mode 100644 index 0000000..5c90e0a --- /dev/null +++ b/dbt_packages/dbt_utils/.circleci/config.yml @@ -0,0 +1,94 @@ + +version: 2.1 + +jobs: + + integration-postgres: + docker: + - image: cimg/python:3.9 + - image: cimg/postgres:9.6 + environment: + POSTGRES_USER: root + environment: + POSTGRES_TEST_HOST: localhost + POSTGRES_TEST_USER: root + POSTGRES_TEST_PASS: '' + POSTGRES_TEST_PORT: 5432 + POSTGRES_TEST_DBNAME: circle_test + + steps: + - checkout + - run: pip install --pre dbt-postgres -r dev-requirements.txt + - run: + name: "Run Functional Tests - Postgres" + command: ./run_functional_test.sh postgres + - run: + name: "Run OG Tests - Postgres" + command: ./run_test.sh postgres + - store_artifacts: + path: ./logs + + integration-redshift: + docker: + - image: cimg/python:3.9 + steps: + - checkout + - run: pip install --pre dbt-redshift -r dev-requirements.txt + - run: + name: "Run Functional Tests - Redshift" + command: ./run_functional_test.sh redshift + - run: + name: "Run OG Tests - Redshift" + command: ./run_test.sh redshift + - store_artifacts: + path: ./logs + + integration-snowflake: + docker: + - image: cimg/python:3.9 + steps: + - checkout + - run: pip install --pre dbt-snowflake -r dev-requirements.txt + - run: + name: "Run Functional Tests - Snowflake" + command: ./run_functional_test.sh snowflake + - run: + name: "Run OG Tests - Snowflake" + command: ./run_test.sh snowflake + - store_artifacts: + path: ./logs + + integration-bigquery: + environment: + BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" + docker: + - image: cimg/python:3.9 + steps: + - checkout + - run: pip install --pre dbt-bigquery -r dev-requirements.txt + - run: + name: "Set up credentials" + command: echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json + - run: + name: "Run Functional Tests - BigQuery" + command: ./run_functional_test.sh bigquery + - run: + name: "Run OG Tests - BigQuery" + command: ./run_test.sh bigquery + - store_artifacts: + path: ./logs + +workflows: + version: 2 + test-all: + jobs: + - integration-postgres + - integration-redshift: + requires: + - integration-postgres + - integration-snowflake: + requires: + - integration-postgres + - integration-bigquery: + requires: + - integration-postgres diff --git a/dbt_packages/dbt_utils/.github/CODEOWNERS b/dbt_packages/dbt_utils/.github/CODEOWNERS new file mode 100644 index 0000000..0f94434 --- /dev/null +++ b/dbt_packages/dbt_utils/.github/CODEOWNERS @@ -0,0 +1 @@ +* @clrcrl diff --git a/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/bug_report.md b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dba969e --- /dev/null +++ b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,60 @@ +--- +name: Bug report +about: Report a bug or an issue you've found with this package +title: '' +labels: bug, triage +assignees: '' + +--- + +### Describe the bug + + +### Steps to reproduce + + +### Expected results + + +### Actual results + + +### Screenshots and log output + + +### System information +**The contents of your `packages.yml` file:** + +**Which database are you using dbt with?** +- [ ] postgres +- [ ] redshift +- [ ] bigquery +- [ ] snowflake +- [ ] other (specify: ____________) + + +**The output of `dbt --version`:** +``` + +``` + + +### Additional context + + +### Are you interested in contributing the fix? + diff --git a/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/dbt_minor_release.md b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/dbt_minor_release.md new file mode 100644 index 0000000..1a29b39 --- /dev/null +++ b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/dbt_minor_release.md @@ -0,0 +1,29 @@ +--- +name: dbt Minor Release Follow-Up +about: A checklist of tasks to complete after a minor release is made to dbt +title: 'dbt Minor Release Follow up for dbt v0.x.0' +labels: +assignees: '' +--- + + + +First, check if this is a breaking change +- [ ] Increase the upper bound of the `require-dbt-version` config in the `dbt_project.yml` +- [ ] Increase the upper bound of the dbt version in `run_test.sh` +- [ ] Create a PR against the `master` branch to see if tests pass + +If test pass, this is _not_ a breaking change. You should: +- [ ] Merge into `master` +- [ ] Create a patch release + +If tests fail, this _is_ a breaking change. You'll need to create a minor release: +- [ ] Change the PR base to be against the next `dev` branch. +- [ ] Increase the lower bound to the current dbt minor version in both the `dbt_project.yml` and `run_test.sh` files +- [ ] Fix any errors +- [ ] Merge `dev` into `master` +- [ ] Create a minor release +- [ ] Once the release is available on hub, [create a new issue](https://github.com/fishtown-analytics/dbt-utils/issues/new/choose) using the "dbt-utils Minor Release Checklist" template diff --git a/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/feature_request.md b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..7f88355 --- /dev/null +++ b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,25 @@ +--- +name: Feature request +about: Suggest an idea for this package +title: '' +labels: enhancement, triage +assignees: '' + +--- + +### Describe the feature +A clear and concise description of what you want to happen. + +### Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. + +### Additional context +Is this feature database-specific? Which database(s) is/are relevant? Please include any other relevant context here. + +### Who will this benefit? +What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly. + +### Are you interested in contributing this feature? + diff --git a/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/utils_minor_release.md b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/utils_minor_release.md new file mode 100644 index 0000000..f6f5af1 --- /dev/null +++ b/dbt_packages/dbt_utils/.github/ISSUE_TEMPLATE/utils_minor_release.md @@ -0,0 +1,38 @@ +--- +name: dbt-utils Minor Release Follow-up +about: A checklist of tasks to complete after making a dbt-utils minor release +title: 'dbt Minor Release Follow up for dbt-utils v0.x.0' +labels: +assignees: '' +--- + + + +## Process for each dependent package +First, check if this is a breaking change +- [ ] Increase the upper bound of the `dbt-utils` `version:` config in the `packages.yml` of the dependent package. +- [ ] Push to a new branch to see if tests pass, or test locally. + +If this is _not_ a breaking change: +- [ ] Create a patch release + +If this _is_ a breaking change: +- [ ] Fix any breaking changes +- [ ] Increase the lower bound to the current dbt-utils minor version +- [ ] Create a minor release for the package + +## Checklist of dependent packages +| Package | PR | Release | +|------------------------------------------------------------------------------|--------|-------------| +| [audit-helper](https://github.com/fishtown-analytics/dbt-audit-helper) | [PR]() | [Release]() | +| [codegen](https://github.com/fishtown-analytics/dbt-codegen) | [PR]() | [Release]() | +| [redshift](https://github.com/fishtown-analytics/redshift) | [PR]() | [Release]() | +| [event-logging](https://github.com/fishtown-analytics/dbt-event-logging) | [PR]() | [Release]() | +| [snowplow](https://github.com/fishtown-analytics/snowplow) | [PR]() | [Release]() | +| [external-tables](https://github.com/fishtown-analytics/dbt-external-tables) | [PR]() | [Release]() | +| [segment](https://github.com/fishtown-analytics/segment) | [PR]() | [Release]() | +| [facebook-ads](https://github.com/fishtown-analytics/facebook-ads) | [PR]() | [Release]() | +| [stitch-utils](https://github.com/fishtown-analytics/stitch-utils) | [PR]() | [Release]() | diff --git a/dbt_packages/dbt_utils/.github/pull_request_template.md b/dbt_packages/dbt_utils/.github/pull_request_template.md new file mode 100644 index 0000000..c0b613c --- /dev/null +++ b/dbt_packages/dbt_utils/.github/pull_request_template.md @@ -0,0 +1,26 @@ +This is a: +- [ ] documentation update +- [ ] bug fix with no breaking changes +- [ ] new functionality +- [ ] a breaking change + +All pull requests from community contributors should target the `main` branch (default). + +## Description & motivation + + +## Checklist +- [ ] I have verified that these changes work locally on the following warehouses (Note: it's okay if you do not have access to all warehouses, this helps us understand what has been covered) + - [ ] BigQuery + - [ ] Postgres + - [ ] Redshift + - [ ] Snowflake +- [ ] I followed guidelines to ensure that my changes will work on "non-core" adapters by: + - [ ] dispatching any new macro(s) so non-core adapters can also use them (e.g. [the `star()` source](https://github.com/fishtown-analytics/dbt-utils/blob/master/macros/sql/star.sql)) + - [ ] using the `limit_zero()` macro in place of the literal string: `limit 0` + - [ ] using `dbt_utils.type_*` macros instead of explicit datatypes (e.g. `dbt_utils.type_timestamp()` instead of `TIMESTAMP` +- [ ] I have updated the README.md (if applicable) +- [ ] I have added tests & descriptions to my models (and macros if applicable) +- [ ] I have added an entry to CHANGELOG.md diff --git a/dbt_packages/dbt_utils/.gitignore b/dbt_packages/dbt_utils/.gitignore new file mode 100644 index 0000000..d155937 --- /dev/null +++ b/dbt_packages/dbt_utils/.gitignore @@ -0,0 +1,9 @@ + +target/ +dbt_modules/ +dbt_packages/ +logs/ +venv/ +env/ +test.env +__pycache__ \ No newline at end of file diff --git a/dbt_packages/dbt_utils/CHANGELOG.md b/dbt_packages/dbt_utils/CHANGELOG.md new file mode 100644 index 0000000..06c063b --- /dev/null +++ b/dbt_packages/dbt_utils/CHANGELOG.md @@ -0,0 +1,374 @@ + + +# dbt-utils v0.8.6 + +## New features +- New macros `array_append` and `array_construct` ([#595](https://github.com/dbt-labs/dbt-utils/pull/595)) + +## Fixes +- Use `*` in `star` macro if no columns (for SQLFluff) ([#605](https://github.com/dbt-labs/dbt-utils/issues/605), [#561](https://github.com/dbt-labs/dbt-utils/pull/561)) +- Only raise error within `union_relations` for `build`/`run` sub-commands ([#606](https://github.com/dbt-labs/dbt-utils/issues/606), [#607](https://github.com/dbt-labs/dbt-utils/pull/607)) + +## Quality of life +- Add slugify to list of Jinja Helpers ([#602](https://github.com/dbt-labs/dbt-utils/pull/602)) + +## Under the hood +- Fix `make test` for running integration tests locally ([#344](https://github.com/dbt-labs/dbt-utils/issues/344), [#564](https://github.com/dbt-labs/dbt-utils/issues/564), [#591](https://github.com/dbt-labs/dbt-utils/pull/591)) + +## Contributors: +- [@swanjson](https://github.com/swanjson) (#561) +- [@dataders](https://github.com/dataders) (#561) +- [@epapineau](https://github.com/epapineau) (#583) +- [@graciegoheen](https://github.com/graciegoheen) (#595) +- [@jeremyyeo](https://github.com/jeremyyeo) (#606) + +# dbt-utils v0.8.5 +## 🚨 deduplicate ([#542](https://github.com/dbt-labs/dbt-utils/pull/542), [#548](https://github.com/dbt-labs/dbt-utils/pull/548)) + +The call signature of `deduplicate` has changed. The previous call signature is marked as deprecated and will be removed in the next minor version. + +- The `group_by` argument is now deprecated and replaced by `partition_by`. +- The `order_by` argument is now required. +- The `relation_alias` argument has been removed as the macro now supports `relation` as a string directly. If you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation`. + +Before: +```jinja +{% macro deduplicate(relation, group_by, order_by=none, relation_alias=none) -%} +... +{% endmacro %} +``` + +After: +```jinja +{% macro deduplicate(relation, partition_by, order_by) -%} +... +{% endmacro %} +``` + +## New features +- Add an optional `where` clause parameter to `get_column_values()` to filter values returned ([#511](https://github.com/dbt-labs/dbt-utils/issues/511), [#583](https://github.com/dbt-labs/dbt-utils/pull/583)) +- Add `where` parameter to `union_relations` macro ([#554](https://github.com/dbt-labs/dbt-utils/pull/554)) +- Add Postgres specific implementation of `deduplicate()` ([#548](https://github.com/dbt-labs/dbt-utils/pull/548)) +- Add Snowflake specific implementation of `deduplicate()` ([#543](https://github.com/dbt-labs/dbt-utils/issues/543), [#548](https://github.com/dbt-labs/dbt-utils/pull/548)) + +## Fixes +- Enable a negative part_number for `split_part()` ([#557](https://github.com/dbt-labs/dbt-utils/issues/557), [#559](https://github.com/dbt-labs/dbt-utils/pull/559)) + +## Quality of life +- Documentation about listagg macro ([#544](https://github.com/dbt-labs/dbt-utils/issues/544), [#560](https://github.com/dbt-labs/dbt-utils/pull/560)) +- Fix links to macro section in table of contents ([#555](https://github.com/dbt-labs/dbt-utils/pull/555)) +- Use the ADR (Architectural Design Record) pattern for documenting significant decisions ([#573](https://github.com/dbt-labs/dbt-utils/pull/573)) +- Contributing guide ([#574](https://github.com/dbt-labs/dbt-utils/pull/574)) +- Add better documentation for `deduplicate()` ([#542](https://github.com/dbt-labs/dbt-utils/pull/542), [#548](https://github.com/dbt-labs/dbt-utils/pull/548)) + +## Under the hood +- Fail integration tests appropriately ([#540](https://github.com/dbt-labs/dbt-utils/issues/540), [#545](https://github.com/dbt-labs/dbt-utils/pull/545)) +- Upgrade CircleCI postgres convenience image ([#584](https://github.com/dbt-labs/dbt-utils/issues/584), [#585](https://github.com/dbt-labs/dbt-utils/pull/585)) +- Run test for `deduplicate` ([#579](https://github.com/dbt-labs/dbt-utils/issues/579), [#580](https://github.com/dbt-labs/dbt-utils/pull/580)) +- Reduce warnings when executing integration tests ([#558](https://github.com/dbt-labs/dbt-utils/issues/558), [#581](https://github.com/dbt-labs/dbt-utils/pull/581)) +- Framework for functional testing using `pytest` ([#588](https://github.com/dbt-labs/dbt-utils/pull/588)) + +## Contributors: +- [@graciegoheen](https://github.com/graciegoheen) (#560) +- [@judahrand](https://github.com/judahrand) (#548) +- [@clausherther](https://github.com/clausherther) (#555) +- [@LewisDavies](https://github.com/LewisDavies) (#554) +- [@epapineau](https://github.com/epapineau) (#583) +- [@b-per](https://github.com/b-per) (#559) + +# dbt-utils v0.8.4 +## Fixes +- Change from quotes to backticks for BQ ([#536](https://github.com/dbt-labs/dbt-utils/issues/536), [#537](https://github.com/dbt-labs/dbt-utils/pull/537)) + +# dbt-utils v0.8.3 +## New features +- A macro for deduplicating data, `deduplicate()` ([#335](https://github.com/dbt-labs/dbt-utils/issues/335), [#512](https://github.com/dbt-labs/dbt-utils/pull/512)) +- A cross-database implementation of `listagg()` ([#530](https://github.com/dbt-labs/dbt-utils/pull/530)) +- A new macro to get the columns in a relation as a list, `get_filtered_columns_in_relation()`. This is similar to the `star()` macro, but creates a Jinja list instead of a comma-separated string. ([#516](https://github.com/dbt-labs/dbt-utils/pull/516)) + +## Fixes +- `get_column_values()` once more raises an error when the model doesn't exist and there is no default provided ([#531](https://github.com/dbt-labs/dbt-utils/issues/531), [#533](https://github.com/dbt-labs/dbt-utils/pull/533)) +- `get_column_values()` raises an error when used with an ephemeral model, instead of getting stuck in a compilation loop ([#358](https://github.com/dbt-labs/dbt-utils/issues/358), [#518](https://github.com/dbt-labs/dbt-utils/pull/518)) +- BigQuery materialized views work correctly with `get_relations_by_pattern()` ([#525](https://github.com/dbt-labs/dbt-utils/pull/525)) + +## Quality of life +- Updated references to 'schema test' in project file structure and documentation ([#485](https://github.com/dbt-labs/dbt-utils/issues/485), [#521](https://github.com/dbt-labs/dbt-utils/pull/521)) +- `date_trunc()` and `datediff()` default macros now have whitespace control to assist with linting and readability [#529](https://github.com/dbt-labs/dbt-utils/pull/529) +- `star()` no longer raises an error during SQLFluff linting ([#506](https://github.com/dbt-labs/dbt-utils/issues/506), [#532](https://github.com/dbt-labs/dbt-utils/pull/532)) + +## Contributors: +- [@judahrand](https://github.com/judahrand) (#512) +- [@b-moynihan](https://github.com/b-moynihan) (#521) +- [@sunriselong](https://github.com/sunriselong) (#529) +- [@jpmmcneill](https://github.com/jpmmcneill) (#533) +- [@KamranAMalik](https://github.com/KamranAMalik) (#532) +- [@graciegoheen](https://github.com/graciegoheen) (#530) +- [@luisleon90](https://github.com/luisleon90) (#525) +- [@epapineau](https://github.com/epapineau) (#518) +- [@patkearns10](https://github.com/patkearns10) (#516) + +# dbt-utils v0.8.2 +## Fixes +- Fix union_relations error from [#473](https://github.com/dbt-labs/dbt-utils/pull/473) when no include/exclude parameters are provided ([#505](https://github.com/dbt-labs/dbt-utils/issues/505), [#509](https://github.com/dbt-labs/dbt-utils/pull/509)) + +# dbt-utils v0.8.1 +## New features +- A cross-database implementation of `any_value()` ([#497](https://github.com/dbt-labs/dbt-utils/issues/497), [#501](https://github.com/dbt-labs/dbt-utils/pull/501)) +- A cross-database implementation of `bool_or()` ([#504](https://github.com/dbt-labs/dbt-utils/pull/504)) + +## Under the hood +- also ignore `dbt_packages/` directory [#463](https://github.com/dbt-labs/dbt-utils/pull/463) +- Remove block comments to make date_spine macro compatible with the Athena connector ([#462](https://github.com/dbt-labs/dbt-utils/pull/462)) + +## Fixes +- `type_timestamp` macro now explicitly casts postgres and redshift warehouse timestamp data types as `timestamp without time zone`, to be consistent with Snowflake behaviour (`timestamp_ntz`). +- `union_relations` macro will now raise an exception if the use of `include` or `exclude` results in no columns ([#473](https://github.com/dbt-labs/dbt-utils/pull/473), [#266](https://github.com/dbt-labs/dbt-utils/issues/266)). +- `get_relations_by_pattern()` works with foreign data wrappers on Postgres again. ([#357](https://github.com/dbt-labs/dbt-utils/issues/357), [#476](https://github.com/dbt-labs/dbt-utils/pull/476)) +- `star()` will only alias columns if a prefix/suffix is provided, to allow the unmodified output to still be used in `group by` clauses etc. [#468](https://github.com/dbt-labs/dbt-utils/pull/468) +- The `sequential_values` test is now compatible with quoted columns [#479](https://github.com/dbt-labs/dbt-utils/pull/479) +- `pivot()` escapes values containing apostrophes [#503](https://github.com/dbt-labs/dbt-utils/pull/503) + +## Contributors: +- [grahamwetzler](https://github.com/grahamwetzler) (#473) +- [Aesthet](https://github.com/Aesthet) (#476) +- [Kamitenshi](https://github.com/Kamitenshi) (#462) +- [nickperrott](https://github.com/nickperrott) (#468) +- [jelstongreen](https://github.com/jelstongreen) (#468) +- [armandduijn](https://github.com/armandduijn) (#479) +- [mdutoo](https://github.com/mdutoo) (#503) + +# dbt-utils v0.8.0 +## 🚨 Breaking changes +- dbt ONE POINT OH is here! This version of dbt-utils requires _any_ version (minor and patch) of v1, which means far less need for compatibility releases in the future. +- The partition column in the `mutually_exclusive_ranges` test is now always called `partition_by_col`. This enables compatibility with `--store-failures` when multiple columns are concatenated together. If you have models built on top of the failures table, update them to reflect the new column name. ([#423](https://github.com/dbt-labs/dbt-utils/issues/423), [#430](https://github.com/dbt-labs/dbt-utils/pull/430)) + +## Contributors: +- [codigo-ergo-sum](https://github.com/codigo-ergo-sum) (#430) + +# dbt-utils 0.7.5 +🚨 This is a compatibility release in preparation for `dbt-core` v1.0.0 (🎉). Projects using dbt-utils 0.7.4 with dbt-core v1.0.0 can expect to see a deprecation warning. This will be resolved in dbt_utils v0.8.0. + +## Fixes +- Regression in `get_column_values()` where the default would not be respected if the model didn't exist. ([#444](https://github.com/dbt-labs/dbt-utils/issues/444), [#448](https://github.com/dbt-labs/dbt-utils/pull/448)) + +## Under the hood +- get_url_host() macro now correctly handles URLs beginning with android-app:// (#426) + +## Contributors: +- [foundinblank](https://github.com/foundinblank) + +# dbt-utils v0.7.4 +## Fixes +- `get_column_values()` now works correctly with mixed-quoting styles on Snowflake ([#424](https://github.com/dbt-labs/dbt-utils/issues/424), [#440](https://github.com/dbt-labs/dbt-utils/pull/440)) +- Remove extra semicolon in `insert_by_period` materialization that was causing errors ([#439](https://github.com/dbt-labs/dbt-utils/pull/439)) +- Swap `limit 0` out for `{{ limit_zero() }}` on the `slugify()` tests to allow for compatibility with [tsql-utils](https://github.com/dbt-msft/tsql-utils) ([#437](https://github.com/dbt-labs/dbt-utils/pull/437)) + +## Contributors: +- [sean-rose](https://github.com/sean-rose) +- [@swanderz](https://github.com/swanderz) + + +# dbt-utils v0.7.4b1 +:rotating_light:🚨 We have renamed the `master` branch to `main`. If you have a local version of `dbt-utils`, you will need to update to the new branch. See the [GitHub docs](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch#updating-a-local-clone-after-a-branch-name-changes) for more details. + +## Under the hood +- Bump `require-dbt-version` to have an upper bound of `'<=1.0.0'`. +- Url link fixes within the README for `not_constant`, `dateadd`, `datediff` and updated the header `Logger` to `Jinja Helpers`. ([#431](https://github.com/dbt-labs/dbt-utils/pull/431)) +- Fully qualified a `cte_name.*` in the `equality` test to avoid an Exasol error ([#420](https://github.com/dbt-labs/dbt-utils/pull/420)) +- `get_url_host()` macro now correctly handles URLs beginning with `android-app://` ([#426](https://github.com/dbt-labs/dbt-utils/pull/426)) + +## Contributors: +- [joemarkiewicz](https://github.com/fivetran-joemarkiewicz) +- [TimoKruth](https://github.com/TimoKruth) +- [foundinblank](https://github.com/foundinblank) + +# dbt-utils v0.7.3 + +## Under the hood + +- Fix bug introduced in 0.7.2 in dbt_utils.star which could cause the except argument to drop columns that were not explicitly specified ([#418](https://github.com/dbt-labs/dbt-utils/pull/418)) +- Remove deprecated argument from not_null_proportion ([#416](https://github.com/dbt-labs/dbt-utils/pull/416)) +- Change final select statement in not_null_proportion to avoid false positive failures ([#416](https://github.com/dbt-labs/dbt-utils/pull/416)) + +# dbt-utils v0.7.2 + +## Features + +- Add `not_null_proportion` generic test that allows the user to specify the minimum (`at_least`) tolerated proportion (e.g., `0.95`) of non-null values ([#411](https://github.com/dbt-labs/dbt-utils/pull/411)) + + +## Under the hood +- Allow user to provide any case type when defining the `exclude` argument in `dbt_utils.star()` ([#403](https://github.com/dbt-labs/dbt-utils/pull/403)) +- Log whole row instead of just column name in 'accepted_range' generic test to allow better visibility into failures ([#413](https://github.com/dbt-labs/dbt-utils/pull/413)) +- Use column name to group in 'get_column_values ' to allow better cross db functionality ([#407](https://github.com/dbt-labs/dbt-utils/pull/407)) + +# dbt-utils v0.7.1 + +## Under the hood + +- Declare compatibility with dbt v0.21.0, which has no breaking changes for this package ([#398](https://github.com/fishtown-analytics/dbt-utils/pull/398)) + + +# dbt-utils v0.7.0 +## Breaking changes + +### 🚨 New dbt version + +dbt v0.20.0 or greater is required for this release. If you are not ready to upgrade, consider using a previous release of this package. + +In accordance with the version upgrade, this package release includes breaking changes to: +- Generic (schema) tests +- `dispatch` functionality + +### 🚨 get_column_values +The order of (optional) arguments has changed in the `get_column_values` macro. + +Before: +```jinja +{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%} +... +{% endmacro %} +``` + +After: +```jinja +{% macro get_column_values(table, column, max_records=none, default=none) -%} +... +{% endmacro %} +``` +If you were relying on the position to match up your optional arguments, this may be a breaking change — in general, we recommend that you explicitly declare any optional arguments (if not all of your arguments!) +``` +-- before: This works on previous version of dbt-utils, but on 0.7.0, the `50` would be passed through as the `order_by` argument +{% set payment_methods = dbt_utils.get_column_values( + ref('stg_payments'), + 'payment_method', + 50 +) %} + +-- after +{% set payment_methods = dbt_utils.get_column_values( + ref('stg_payments'), + 'payment_method', + max_records=50 +) %} +``` + +## Features +* Add new argument, `order_by`, to `get_column_values` (code originally in [#289](https://github.com/fishtown-analytics/dbt-utils/pull/289/) from [@clausherther](https://github.com/clausherther), merged via [#349](https://github.com/fishtown-analytics/dbt-utils/pull/349/)) +* Add `slugify` macro, and use it in the pivot macro. :rotating_light: This macro uses the `re` module, which is only available in dbt v0.19.0+. As a result, this feature introduces a breaking change. ([#314](https://github.com/fishtown-analytics/dbt-utils/pull/314)) +* Add `not_null_proportion` generic test that allows the user to specify the minimum (`at_least`) tolerated proportion (e.g., `0.95`) of non-null values + +## Under the hood +* Update the default implementation of concat macro to use `||` operator ([#373](https://github.com/fishtown-analytics/dbt-utils/pull/314) from [@ChristopheDuong](https://github.com/ChristopheDuong)). Note this may be a breaking change for adapters that support `concat()` but not `||`, such as Apache Spark. +- Use `power()` instead of `pow()` in `generate_series()` and `haversine_distance()` as they are synonyms in most SQL dialects, but some dialects only have `power()` ([#354](https://github.com/fishtown-analytics/dbt-utils/pull/354) from [@swanderz](https://github.com/swanderz)) +- Make `get_column_values` return the default value passed as a parameter instead of an empty string before compilation ([#304](https://github.com/dbt-labs/dbt-utils/pull/386) from [@jmriego](https://github.com/jmriego) + +# dbt-utils v0.6.6 + +## Fixes + +- make `sequential_values` generic test use `dbt_utils.type_timestamp()` to allow for compatibility with db's without timestamp data type. [#376](https://github.com/fishtown-analytics/dbt-utils/pull/376) from [@swanderz](https://github.com/swanderz) + +# dbt-utils v0.6.5 +## Features +* Add new `accepted_range` test ([#276](https://github.com/fishtown-analytics/dbt-utils/pull/276) [@joellabes](https://github.com/joellabes)) +* Make `expression_is_true` work as a column test (code originally in [#226](https://github.com/fishtown-analytics/dbt-utils/pull/226/) from [@elliottohara](https://github.com/elliottohara), merged via [#313](https://github.com/fishtown-analytics/dbt-utils/pull/313/)) +* Add new generic test, `not_accepted_values` ([#284](https://github.com/fishtown-analytics/dbt-utils/pull/284) [@JavierMonton](https://github.com/JavierMonton)) +* Support a new argument, `zero_length_range_allowed` in the `mutually_exclusive_ranges` test ([#307](https://github.com/fishtown-analytics/dbt-utils/pull/307) [@zemekeneng](https://github.com/zemekeneng)) +* Add new generic test, `sequential_values` ([#318](https://github.com/fishtown-analytics/dbt-utils/pull/318), inspired by [@hundredwatt](https://github.com/hundredwatt)) +* Support `quarter` in the `postgres__last_day` macro ([#333](https://github.com/fishtown-analytics/dbt-utils/pull/333/files) [@seunghanhong](https://github.com/seunghanhong)) +* Add new argument, `unit`, to `haversine_distance` ([#340](https://github.com/fishtown-analytics/dbt-utils/pull/340) [@bastienboutonnet](https://github.com/bastienboutonnet)) +* Add new generic test, `fewer_rows_than` (code originally in [#221](https://github.com/fishtown-analytics/dbt-utils/pull/230/) from [@dmarts](https://github.com/dmarts), merged via [#343](https://github.com/fishtown-analytics/dbt-utils/pull/343/)) + +## Fixes +* Handle booleans gracefully in the unpivot macro ([#305](https://github.com/fishtown-analytics/dbt-utils/pull/305) [@avishalom](https://github.com/avishalom)) +* Fix a bug in `get_relation_by_prefix` that happens with Snowflake external tables. Now the macro will retrieve tables that match the prefix which are external tables ([#351](https://github.com/fishtown-analytics/dbt-utils/pull/351)) +* Fix `cardinality_equality` test when the two tables' column names differed ([#334](https://github.com/fishtown-analytics/dbt-utils/pull/334) [@joellabes](https://github.com/joellabes)) + +## Under the hood +* Fix Markdown formatting for hub rendering ([#336](https://github.com/fishtown-analytics/dbt-utils/issues/350) [@coapacetic](https://github.com/coapacetic)) +* Reorder readme and improve docs + +# dbt-utils v0.6.4 + +### Fixes +- Fix `insert_by_period` to support `dbt v0.19.0`, with backwards compatibility for earlier versions ([#319](https://github.com/fishtown-analytics/dbt-utils/pull/319), [#320](https://github.com/fishtown-analytics/dbt-utils/pull/320)) + +### Under the hood +- Speed up CI via threads, workflows ([#315](https://github.com/fishtown-analytics/dbt-utils/pull/315), [#316](https://github.com/fishtown-analytics/dbt-utils/pull/316)) +- Fix `equality` test when used with ephemeral models + explicit column set ([#321](https://github.com/fishtown-analytics/dbt-utils/pull/321)) +- Fix `get_query_results_as_dict` integration test with consistent ordering ([#322](https://github.com/fishtown-analytics/dbt-utils/pull/322)) +- All macros are now properly dispatched, making it possible for non-core adapters to implement a shim package for dbt-utils ([#312](https://github.com/fishtown-analytics/dbt-utils/pull/312)) Thanks [@chaerinlee1](https://github.com/chaerinlee1) and [@swanderz](https://github.com/swanderz) +- Small, non-breaking changes to accomodate TSQL (can't group by column number references, no real TRUE/FALSE values, aggregation CTEs need named columns) ([#310](https://github.com/fishtown-analytics/dbt-utils/pull/310)) Thanks [@swanderz](https://github.com/swanderz) +- Make `get_relations_by_pattern` and `get_relations_by_prefix` more powerful by returning `relation.type` ([#323](https://github.com/fishtown-analytics/dbt-utils/pull/323)) + +# dbt-utils v0.6.3 + +- Bump `require-dbt-version` to `[">=0.18.0", "<0.20.0"]` to support dbt v0.19.0 ([#308](https://github.com/fishtown-analytics/dbt-utils/pull/308), [#309](https://github.com/fishtown-analytics/dbt-utils/pull/309)) + +# dbt-utils v0.6.2 + +## Fixes +- Fix the logic in `get_tables_by_pattern_sql` to ensure non-default arguments are respected ([#279](https://github.com/fishtown-analytics/dbt-utils/pull/279)) + + +# dbt-utils v0.6.1 + +## Fixes +- Fix the logic in `get_tables_by_pattern_sql` for matching a schema pattern on BigQuery ([#275](https://github.com/fishtown-analytics/dbt-utils/pull/275/)) + +# dbt-utils v0.6.0 + +## Breaking changes +- :rotating_light: dbt v0.18.0 or greater is required for this release. If you are not ready to upgrade, consider using a previous release of this package +- :rotating_light: The `get_tables_by_prefix`, `union_tables` and `get_tables_by_pattern` macros have been removed + +## Migration instructions +- Upgrade your dbt project to v0.18.0 using [these instructions](https://discourse.getdbt.com/t/prerelease-v0-18-0-marian-anderson/1545). +- Upgrade your `packages.yml` file to use version `0.6.0` of this package. Run `dbt clean` and `dbt deps`. +- If your project uses the `get_tables_by_prefix` macro, replace it with `get_relations_by_prefix`. All arguments have retained the same name. +- If your project uses the `union_tables` macro, replace it with `union_relations`. While the order of arguments has stayed consistent, the `tables` argument has been renamed to `relations`. Further, the default value for the `source_column_name` argument has changed from `'_dbt_source_table'` to `'_dbt_source_relation'` — you may want to explicitly define this argument to avoid breaking changes. + +``` +-- before: +{{ dbt_utils.union_tables( + tables=[ref('my_model'), source('my_source', 'my_table')], + exclude=["_loaded_at"] +) }} + +-- after: +{{ dbt_utils.union_relations( + relations=[ref('my_model'), source('my_source', 'my_table')], + exclude=["_loaded_at"], + source_column_name='_dbt_source_table' +) }} +``` +- If your project uses the `get_tables_by_pattern` macro, replace it with `get_tables_by_pattern_sql` — all arguments are consistent. + +## Features + +* Switch usage of `adapter_macro` to `adapter.dispatch`, and define `dbt_utils_dispatch_list`, +enabling users of community-supported database plugins to add or override macro implementations +specific to their database ([#267](https://github.com/fishtown-analytics/dbt-utils/pull/267)) +* Use `add_ephemeral_prefix` instead of hard-coding a string literal, to support +database adapters that use different prefixes ([#267](https://github.com/fishtown-analytics/dbt-utils/pull/267)) +* Implement a quote_columns argument in the unique_combination_of_columns generic test ([#270](https://github.com/fishtown-analytics/dbt-utils/pull/270) [@JoshuaHuntley](https://github.com/JoshuaHuntley)) + +## Quality of life +* Remove deprecated macros `get_tables_by_prefix` and `union_tables` ([#268](https://github.com/fishtown-analytics/dbt-utils/pull/268)) +* Remove `get_tables_by_pattern` macro, which is equivalent to the `get_tables_by_pattern_sql` macro (the latter has a more logical name) ([#268](https://github.com/fishtown-analytics/dbt-utils/pull/268)) + +# dbt-utils v0.5.1 + +## Quality of life +* Improve release process, and fix tests ([#251](https://github.com/fishtown-analytics/dbt-utils/pull/251)) +* Make deprecation warnings more useful ([#258](https://github.com/fishtown-analytics/dbt-utils/pull/258) [@tayloramurphy](https://github.com/tayloramurphy)) +* Add more docs for `date_spine` ([#265](https://github.com/fishtown-analytics/dbt-utils/pull/265) [@calvingiles](https://github.com/calvingiles)) diff --git a/dbt_packages/dbt_utils/CONTRIBUTING.md b/dbt_packages/dbt_utils/CONTRIBUTING.md new file mode 100644 index 0000000..84c8679 --- /dev/null +++ b/dbt_packages/dbt_utils/CONTRIBUTING.md @@ -0,0 +1,85 @@ +# Contributing to `dbt-utils` + +`dbt-utils` is open source software. It is what it is today because community members have opened issues, provided feedback, and [contributed to the knowledge loop](https://www.getdbt.com/dbt-labs/values/). Whether you are a seasoned open source contributor or a first-time committer, we welcome and encourage you to contribute code, documentation, ideas, or problem statements to this project. + +1. [About this document](#about-this-document) +1. [Getting the code](#getting-the-code) +1. [Setting up an environment](#setting-up-an-environment) +1. [Implementation guidelines](#implementation-guidelines) +1. [Testing dbt-utils](#testing) +1. [Adding CHANGELOG Entry](#adding-changelog-entry) +1. [Submitting a Pull Request](#submitting-a-pull-request) + +## About this document + +There are many ways to contribute to the ongoing development of `dbt-utils`, such as by participating in discussions and issues. We encourage you to first read our higher-level document: ["Expectations for Open Source Contributors"](https://docs.getdbt.com/docs/contributing/oss-expectations). + +The rest of this document serves as a more granular guide for contributing code changes to `dbt-utils` (this repository). It is not intended as a guide for using `dbt-utils`, and some pieces assume a level of familiarity with Python development (virtualenvs, `pip`, etc). Specific code snippets in this guide assume you are using macOS or Linux and are comfortable with the command line. + +### Notes + +- **CLA:** Please note that anyone contributing code to `dbt-utils` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `dbt-utils` maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones. +- **Branches:** All pull requests from community contributors should target the `main` branch (default). If the change is needed as a patch for a version of `dbt-utils` that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant branch. + +## Getting the code + +### Installing git + +You will need `git` in order to download and modify the `dbt-utils` source code. On macOS, the best way to download git is to just install [Xcode](https://developer.apple.com/support/xcode/). + +### External contributors + +If you are not a member of the `dbt-labs` GitHub organization, you can contribute to `dbt-utils` by forking the `dbt-utils` repository. For a detailed overview on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). In short, you will need to: + +1. Fork the `dbt-utils` repository +2. Clone your fork locally +3. Check out a new branch for your proposed changes +4. Push changes to your fork +5. Open a pull request against `dbt-labs/dbt-utils` from your forked repository + +### dbt Labs contributors + +If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `dbt-utils` repo. Rather than forking `dbt-utils` to make your changes, just clone the repository, check out a new branch, and push directly to that branch. + +## Setting up an environment + +There are some tools that will be helpful to you in developing locally. While this is the list relevant for `dbt-utils` development, many of these tools are used commonly across open-source python projects. + +### Tools + +These are the tools used in `dbt-utils` development and testing: +- [`make`](https://users.cs.duke.edu/~ola/courses/programming/Makefiles/Makefiles.html) to run multiple setup or test steps in combination. Don't worry too much, nobody _really_ understands how `make` works, and our Makefile aims to be super simple. +- [CircleCI](https://circleci.com/) for automating tests and checks, once a PR is pushed to the `dbt-utils` repository + +A deep understanding of these tools in not required to effectively contribute to `dbt-utils`, but we recommend checking out the attached documentation if you're interested in learning more about each one. + +## Implementation guidelines + +Ensure that changes will work on "non-core" adapters by: +- dispatching any new macro(s) so non-core adapters can also use them (e.g. [the `star()` source](https://github.com/fishtown-analytics/dbt-utils/blob/master/macros/sql/star.sql)) +- using the `limit_zero()` macro in place of the literal string: `limit 0` +- using `dbt_utils.type_*` macros instead of explicit datatypes (e.g. `dbt_utils.type_timestamp()` instead of `TIMESTAMP` + +## Testing + +Once you're able to manually test that your code change is working as expected, it's important to run existing automated tests, as well as adding some new ones. These tests will ensure that: +- Your code changes do not unexpectedly break other established functionality +- Your code changes can handle all known edge cases +- The functionality you're adding will _keep_ working in the future + +See here for details for running existing integration tests and adding new ones: +- [integration_tests/README.md](integration_tests/README.md) + +## Adding CHANGELOG Entry + +Unlike `dbt-core`, we edit the `CHANGELOG.md` directly. + +You don't need to worry about which `dbt-utils` version your change will go into. Just create the changelog entry at the top of CHANGELOG.md and open your PR against the `main` branch. All merged changes will be included in the next minor version of `dbt-utils`. The maintainers _may_ choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of `dbt-utils`. + +## Submitting a Pull Request + +A `dbt-utils` maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code. + +Automated tests run via CircleCI. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the `dbt-utils` repository trigger integration tests against Postgres [TODO]. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `dbt-utils` code changes. + +Once all tests are passing and your PR has been approved, a `dbt-utils` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada: diff --git a/dbt_packages/dbt_utils/LICENSE b/dbt_packages/dbt_utils/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/dbt_packages/dbt_utils/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/dbt_packages/dbt_utils/Makefile b/dbt_packages/dbt_utils/Makefile new file mode 100644 index 0000000..9d6c74a --- /dev/null +++ b/dbt_packages/dbt_utils/Makefile @@ -0,0 +1,24 @@ +.DEFAULT_GOAL:=help + +.PHONY: test +test: ## Run the integration tests. + @./run_test.sh $(target) $(models) $(seeds) + +.PHONY: dev +dev: ## Installs dbt-* packages in develop mode along with development dependencies. + @\ + echo "Install dbt-$(target)..."; \ + pip install --upgrade pip setuptools; \ + pip install --pre "dbt-$(target)" -r dev-requirements.txt; + +.PHONY: setup-db +setup-db: ## Setup Postgres database with docker-compose for system testing. + @\ + docker-compose up --detach postgres + +.PHONY: help +help: ## Show this help message. + @echo 'usage: make [target]' + @echo + @echo 'targets:' + @grep -E '^[8+a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/dbt_packages/dbt_utils/README.md b/dbt_packages/dbt_utils/README.md new file mode 100644 index 0000000..6d3b7be --- /dev/null +++ b/dbt_packages/dbt_utils/README.md @@ -0,0 +1,1367 @@ +This [dbt](https://github.com/dbt-labs/dbt) package contains macros that can be (re)used across dbt projects. + +## Installation Instructions +Check [dbt Hub](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/) for the latest installation instructions, or [read the docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. + +## Compatibility matrix +For compatibility details between versions of dbt-core and dbt-utils, [see this spreadsheet](https://docs.google.com/spreadsheets/d/1RoDdC69auAtrwiqmkRsgcFdZ3MdNpeKcJrWkmEpXVIs/edit#gid=0). + +---- +## Contents + +**[Generic tests](#generic-tests)** + - [equal_rowcount](#equal_rowcount-source) + - [fewer_rows_than](#fewer_rows_than-source) + - [equality](#equality-source) + - [expression_is_true](#expression_is_true-source) + - [recency](#recency-source) + - [at_least_one](#at_least_one-source) + - [not_constant](#not_constant-source) + - [cardinality_equality](#cardinality_equality-source) + - [unique_where](#unique_where-source) + - [not_null_where](#not_null_where-source) + - [not_null_proportion](#not_null_proportion-source) + - [relationships_where](#relationships_where-source) + - [mutually_exclusive_ranges](#mutually_exclusive_ranges-source) + - [unique_combination_of_columns](#unique_combination_of_columns-source) + - [accepted_range](#accepted_range-source) + +**[Macros](#macros)** + +- [Introspective macros](#introspective-macros): + - [get_column_values](#get_column_values-source) + - [get_filtered_columns_in_relation](#get_filtered_columns_in_relation-source) + - [get_relations_by_pattern](#get_relations_by_pattern-source) + - [get_relations_by_prefix](#get_relations_by_prefix-source) + - [get_query_results_as_dict](#get_query_results_as_dict-source) + +- [SQL generators](#sql-generators) + - [date_spine](#date_spine-source) + - [deduplicate](#deduplicate-source) + - [haversine_distance](#haversine_distance-source) + - [group_by](#group_by-source) + - [star](#star-source) + - [union_relations](#union_relations-source) + - [generate_series](#generate_series-source) + - [surrogate_key](#surrogate_key-source) + - [safe_add](#safe_add-source) + - [pivot](#pivot-source) + - [unpivot](#unpivot-source) + +- [Web macros](#web-macros) + - [get_url_parameter](#get_url_parameter-source) + - [get_url_host](#get_url_host-source) + - [get_url_path](#get_url_path-source) + +- [Cross-database macros](#cross-database-macros): + - [current_timestamp](#current_timestamp-source) + - [dateadd](#dateadd-source) + - [datediff](#datediff-source) + - [split_part](#split_part-source) + - [last_day](#last_day-source) + - [width_bucket](#width_bucket-source) + - [listagg](#listagg-source) + - [array_construct](#array_construct-source) + - [array_append](#array_append-source) + - [array_concat](#array_concat-source) + - [cast_array_to_string](#cast_array_to_string-source) + +- [Jinja Helpers](#jinja-helpers) + - [pretty_time](#pretty_time-source) + - [pretty_log_format](#pretty_log_format-source) + - [log_info](#log_info-source) + - [slugify](#slugify-source) + +[Materializations](#materializations): +- [insert_by_period](#insert_by_period-source) + +---- +### Generic Tests +#### equal_rowcount ([source](macros/generic_tests/equal_rowcount.sql)) +Asserts that two relations have the same number of rows. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.equal_rowcount: + compare_model: ref('other_table_name') + +``` + +#### fewer_rows_than ([source](macros/generic_tests/fewer_rows_than.sql)) +Asserts that the respective model has fewer rows than the model being compared. + +Usage: +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.fewer_rows_than: + compare_model: ref('other_table_name') +``` + +#### equality ([source](macros/generic_tests/equality.sql)) +Asserts the equality of two relations. Optionally specify a subset of columns to compare. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.equality: + compare_model: ref('other_table_name') + compare_columns: + - first_column + - second_column +``` + +#### expression_is_true ([source](macros/generic_tests/expression_is_true.sql)) +Asserts that a valid SQL expression is true for all records. This is useful when checking integrity across columns. +Examples: + +- Verify an outcome based on the application of basic alegbraic operations between columns. +- Verify the length of a column. +- Verify the truth value of a column. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.expression_is_true: + expression: "col_a + col_b = total" +``` + +The macro accepts an optional argument `condition` that allows for asserting +the `expression` on a subset of all records. + +**Usage:** + +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.expression_is_true: + expression: "col_a + col_b = total" + condition: "created_at > '2018-12-31'" +``` + +This macro can also be used at the column level. When this is done, the `expression` is evaluated against the column. + +```yaml +version: 2 +models: + - name: model_name + columns: + - name: col_a + tests: + - dbt_utils.expression_is_true: + expression: '>= 1' + - name: col_b + tests: + - dbt_utils.expression_is_true: + expression: '= 1' + condition: col_a = 1 +``` + +#### recency ([source](macros/generic_tests/recency.sql)) +Asserts that a timestamp column in the reference model contains data that is at least as recent as the defined date interval. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + tests: + - dbt_utils.recency: + datepart: day + field: created_at + interval: 1 +``` + +#### at_least_one ([source](macros/generic_tests/at_least_one.sql)) +Asserts that a column has at least one value. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + columns: + - name: col_name + tests: + - dbt_utils.at_least_one +``` + +#### not_constant ([source](macros/generic_tests/not_constant.sql)) +Asserts that a column does not have the same value in all rows. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + columns: + - name: column_name + tests: + - dbt_utils.not_constant +``` + +#### cardinality_equality ([source](macros/generic_tests/cardinality_equality.sql)) +Asserts that values in a given column have exactly the same cardinality as values from a different column in a different model. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + columns: + - name: from_column + tests: + - dbt_utils.cardinality_equality: + field: other_column_name + to: ref('other_model_name') +``` + +#### unique_where ([source](macros/generic_tests/test_unique_where.sql)) +Asserts that there are no duplicate values present in a field for a subset of rows by specifying a `where` clause. + +*Warning*: This test is no longer supported. Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config. [See the dbt docs for more details](https://docs.getdbt.com/reference/resource-configs/where). + +**Usage:** +```yaml +version: 2 + +models: + - name: my_model + columns: + - name: id + tests: + - dbt_utils.unique_where: + where: "_deleted = false" +``` + +#### not_null_where ([source](macros/generic_tests/test_not_null_where.sql)) +Asserts that there are no null values present in a column for a subset of rows by specifying a `where` clause. + +*Warning*: This test is no longer supported. Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config. [See the dbt docs for more details](https://docs.getdbt.com/reference/resource-configs/where). + +**Usage:** +```yaml +version: 2 + +models: + - name: my_model + columns: + - name: id + tests: + - dbt_utils.not_null_where: + where: "_deleted = false" +``` + +#### not_null_proportion ([source](macros/generic_tests/not_null_proportion.sql)) +Asserts that the proportion of non-null values present in a column is between a specified range [`at_least`, `at_most`] where `at_most` is an optional argument (default: `1.0`). + +**Usage:** +```yaml +version: 2 + +models: + - name: my_model + columns: + - name: id + tests: + - dbt_utils.not_null_proportion: + at_least: 0.95 +``` + +#### not_accepted_values ([source](macros/generic_tests/not_accepted_values.sql)) +Asserts that there are no rows that match the given values. + +Usage: +```yaml +version: 2 + +models: + - name: my_model + columns: + - name: city + tests: + - dbt_utils.not_accepted_values: + values: ['Barcelona', 'New York'] +``` + +#### relationships_where ([source](macros/generic_tests/relationships_where.sql)) +Asserts the referential integrity between two relations (same as the core relationships assertions) with an added predicate to filter out some rows from the test. This is useful to exclude records such as test entities, rows created in the last X minutes/hours to account for temporary gaps due to ETL limitations, etc. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + columns: + - name: id + tests: + - dbt_utils.relationships_where: + to: ref('other_model_name') + field: client_id + from_condition: id <> '4ca448b8-24bf-4b88-96c6-b1609499c38b' + to_condition: created_date >= '2020-01-01' +``` + +#### mutually_exclusive_ranges ([source](macros/generic_tests/mutually_exclusive_ranges.sql)) +Asserts that for a given lower_bound_column and upper_bound_column, +the ranges between the lower and upper bounds do not overlap with the ranges +of another row. + +**Usage:** +```yaml +version: 2 + +models: + # test that age ranges do not overlap + - name: age_brackets + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: min_age + upper_bound_column: max_age + gaps: not_allowed + + # test that each customer can only have one subscription at a time + - name: subscriptions + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: started_at + upper_bound_column: ended_at + partition_by: customer_id + gaps: required + + # test that each customer can have subscriptions that start and end on the same date + - name: subscriptions + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: started_at + upper_bound_column: ended_at + partition_by: customer_id + zero_length_range_allowed: true +``` + +**Args:** +* `lower_bound_column` (required): The name of the column that represents the +lower value of the range. Must be not null. +* `upper_bound_column` (required): The name of the column that represents the +upper value of the range. Must be not null. +* `partition_by` (optional): If a subset of records should be mutually exclusive +(e.g. all periods for a single subscription_id are mutually exclusive), use this +argument to indicate which column to partition by. `default=none` +* `gaps` (optional): Whether there can be gaps are allowed between ranges. +`default='allowed', one_of=['not_allowed', 'allowed', 'required']` +* `zero_length_range_allowed` (optional): Whether ranges can start and end on the same date. +`default=False` + +**Note:** Both `lower_bound_column` and `upper_bound_column` should be not null. +If this is not the case in your data source, consider passing a coalesce function +to the `lower_` and `upper_bound_column` arguments, like so: +```yaml +version: 2 + +models: +- name: subscriptions + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: coalesce(started_at, '1900-01-01') + upper_bound_column: coalesce(ended_at, '2099-12-31') + partition_by: customer_id + gaps: allowed +``` +
+Additional `gaps` and `zero_length_range_allowed` examples + **Understanding the `gaps` argument:** + + Here are a number of examples for each allowed `gaps` argument. + * `gaps: not_allowed`: The upper bound of one record must be the lower bound of + the next record. + + | lower_bound | upper_bound | + |-------------|-------------| + | 0 | 1 | + | 1 | 2 | + | 2 | 3 | + + * `gaps: allowed` (default): There may be a gap between the upper bound of one + record and the lower bound of the next record. + + | lower_bound | upper_bound | + |-------------|-------------| + | 0 | 1 | + | 2 | 3 | + | 3 | 4 | + + * `gaps: required`: There must be a gap between the upper bound of one record and + the lower bound of the next record (common for date ranges). + + | lower_bound | upper_bound | + |-------------|-------------| + | 0 | 1 | + | 2 | 3 | + | 4 | 5 | + + **Understanding the `zero_length_range_allowed` argument:** + Here are a number of examples for each allowed `zero_length_range_allowed` argument. + * `zero_length_range_allowed: false`: (default) The upper bound of each record must be greater than its lower bound. + + | lower_bound | upper_bound | + |-------------|-------------| + | 0 | 1 | + | 1 | 2 | + | 2 | 3 | + + * `zero_length_range_allowed: true`: The upper bound of each record can be greater than or equal to its lower bound. + + | lower_bound | upper_bound | + |-------------|-------------| + | 0 | 1 | + | 2 | 2 | + | 3 | 4 | +
+ +#### sequential_values ([source](macros/generic_tests/sequential_values.sql)) +This test confirms that a column contains sequential values. It can be used +for both numeric values, and datetime values, as follows: +```yml +version: 2 + +seeds: + - name: util_even_numbers + columns: + - name: i + tests: + - dbt_utils.sequential_values: + interval: 2 + + + - name: util_hours + columns: + - name: date_hour + tests: + - dbt_utils.sequential_values: + interval: 1 + datepart: 'hour' +``` + +**Args:** +* `interval` (default=1): The gap between two sequential values +* `datepart` (default=None): Used when the gaps are a unit of time. If omitted, the test will check for a numeric gap. + +#### unique_combination_of_columns ([source](macros/generic_tests/unique_combination_of_columns.sql)) +Asserts that the combination of columns is unique. For example, the +combination of month and product is unique, however neither column is unique +in isolation. + +We generally recommend testing this uniqueness condition by either: +* generating a [surrogate_key](#surrogate_key-source) for your model and testing +the uniqueness of said key, OR +* passing the `unique` test a concatenation of the columns (as discussed [here](https://docs.getdbt.com/docs/building-a-dbt-project/testing-and-documentation/testing/#testing-expressions)). + +However, these approaches can become non-perfomant on large data sets, in which +case we recommend using this test instead. + +**Usage:** +```yaml +- name: revenue_by_product_by_month + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - month + - product +``` + +An optional `quote_columns` argument (`default=false`) can also be used if a column name needs to be quoted. + +```yaml +- name: revenue_by_product_by_month + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - month + - group + quote_columns: true + +``` + +#### accepted_range ([source](macros/generic_tests/accepted_range.sql)) +Asserts that a column's values fall inside an expected range. Any combination of `min_value` and `max_value` is allowed, and the range can be inclusive or exclusive. Provide a `where` argument to filter to specific records only. + +In addition to comparisons to a scalar value, you can also compare to another column's values. Any data type that supports the `>` or `<` operators can be compared, so you could also run tests like checking that all order dates are in the past. + +**Usage:** +```yaml +version: 2 + +models: + - name: model_name + columns: + - name: user_id + tests: + - dbt_utils.accepted_range: + min_value: 0 + inclusive: false + + - name: account_created_at + tests: + - dbt_utils.accepted_range: + max_value: "getdate()" + #inclusive is true by default + + - name: num_returned_orders + tests: + - dbt_utils.accepted_range: + min_value: 0 + max_value: "num_orders" + + - name: num_web_sessions + tests: + - dbt_utils.accepted_range: + min_value: 0 + inclusive: false + where: "num_orders > 0" +``` + +---- + +## Macros + +### Introspective macros +These macros run a query and return the results of the query as objects. They are typically abstractions over the [statement blocks](https://docs.getdbt.com/reference/dbt-jinja-functions/statement-blocks) in dbt. + + +#### get_column_values ([source](macros/sql/get_column_values.sql)) +This macro returns the unique values for a column in a given [relation](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation) as an array. + +**Args:** +- `table` (required): a [Relation](https://docs.getdbt.com/reference/dbt-classes#relation) (a `ref` or `source`) that contains the list of columns you wish to select from +- `column` (required): The name of the column you wish to find the column values of +- `where` (optional, default=`none`): A where clause to filter the column values by. +- `order_by` (optional, default=`'count(*) desc'`): How the results should be ordered. The default is to order by `count(*) desc`, i.e. decreasing frequency. Setting this as `'my_column'` will sort alphabetically, while `'min(created_at)'` will sort by when thevalue was first observed. +- `max_records` (optional, default=`none`): The maximum number of column values you want to return +- `default` (optional, default=`[]`): The results this macro should return if the relation has not yet been created (and therefore has no column values). + + +**Usage:** +```sql +-- Returns a list of the payment_methods in the stg_payments model_ +{% set payment_methods = dbt_utils.get_column_values(table=ref('stg_payments'), column='payment_method') %} + +{% for payment_method in payment_methods %} + ... +{% endfor %} + +... +``` + +```sql +-- Returns the list sorted alphabetically +{% set payment_methods = dbt_utils.get_column_values( + table=ref('stg_payments'), + column='payment_method', + order_by='payment_method' +) %} +``` + +```sql +-- Returns the list sorted my most recently observed +{% set payment_methods = dbt_utils.get_column_values( + table=ref('stg_payments'), + column='payment_method', + order_by='max(created_at) desc', + max_records=50, + default=['bank_transfer', 'coupon', 'credit_card'] +%} +... +``` + +#### get_filtered_columns_in_relation ([source](macros/sql/get_filtered_columns_in_relation.sql)) +This macro returns an iterable Jinja list of columns for a given [relation](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation), (i.e. not from a CTE) +- optionally exclude columns +- the input values are not case-sensitive (input uppercase or lowercase and it will work!) +> Note: The native [`adapter.get_columns_in_relation` macro](https://docs.getdbt.com/reference/dbt-jinja-functions/adapter#get_columns_in_relation) allows you +to pull column names in a non-filtered fashion, also bringing along with it other (potentially unwanted) information, such as dtype, char_size, numeric_precision, etc. + +**Args:** +- `from` (required): a [Relation](https://docs.getdbt.com/reference/dbt-classes#relation) (a `ref` or `source`) that contains the list of columns you wish to select from +- `except` (optional, default=`[]`): The name of the columns you wish to exclude. (case-insensitive) + +**Usage:** +```sql +-- Returns a list of the columns from a relation, so you can then iterate in a for loop +{% set column_names = dbt_utils.get_filtered_columns_in_relation(from=ref('your_model'), except=["field_1", "field_2"]) %} +... +{% for column_name in column_names %} + max({{ column_name }}) ... as max_'{{ column_name }}', +{% endfor %} +... +``` + +#### get_relations_by_pattern ([source](macros/sql/get_relations_by_pattern.sql)) +Returns a list of [Relations](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation) +that match a given schema- or table-name pattern. + +This macro is particularly handy when paired with `union_relations`. + +**Usage:** +``` +-- Returns a list of relations that match schema_pattern%.table +{% set relations = dbt_utils.get_relations_by_pattern('schema_pattern%', 'table_pattern') %} + +-- Returns a list of relations that match schema_pattern.table_pattern% +{% set relations = dbt_utils.get_relations_by_pattern('schema_pattern', 'table_pattern%') %} + +-- Returns a list of relations as above, excluding any that end in `deprecated` +{% set relations = dbt_utils.get_relations_by_pattern('schema_pattern', 'table_pattern%', '%deprecated') %} + +-- Example using the union_relations macro +{% set event_relations = dbt_utils.get_relations_by_pattern('venue%', 'clicks') %} +{{ dbt_utils.union_relations(relations = event_relations) }} +``` + +**Args:** +* `schema_pattern` (required): The schema pattern to inspect for relations. +* `table_pattern` (required): The name of the table/view (case insensitive). +* `exclude` (optional): Exclude any relations that match this table pattern. +* `database` (optional, default = `target.database`): The database to inspect +for relations. + +**Examples:** +Generate drop statements for all Relations that match a naming pattern: +```sql +{% set relations_to_drop = dbt_utils.get_relations_by_pattern( + schema_pattern='public', + table_pattern='dbt\_%' +) %} + +{% set sql_to_execute = [] %} + +{{ log('Statements to run:', info=True) }} + +{% for relation in relations_to_drop %} + {% set drop_command -%} + -- drop {{ relation.type }} {{ relation }} cascade; + {%- endset %} + {% do log(drop_command, info=True) %} + {% do sql_to_execute.append(drop_command) %} +{% endfor %} +``` + +#### get_relations_by_prefix ([source](macros/sql/get_relations_by_prefix.sql)) +> This macro will soon be deprecated in favor of the more flexible `get_relations_by_pattern` macro (above) + +Returns a list of [Relations](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation) +that match a given prefix, with an optional exclusion pattern. It's particularly +handy paired with `union_relations`. + +**Usage:** + +``` +-- Returns a list of relations that match schema.prefix% +{% set relations = dbt_utils.get_relations_by_prefix('my_schema', 'my_prefix') %} + +-- Returns a list of relations as above, excluding any that end in `deprecated` +{% set relations = dbt_utils.get_relations_by_prefix('my_schema', 'my_prefix', '%deprecated') %} + +-- Example using the union_relations macro +{% set event_relations = dbt_utils.get_relations_by_prefix('events', 'event_') %} +{{ dbt_utils.union_relations(relations = event_relations) }} +``` + +**Args:** +* `schema` (required): The schema to inspect for relations. +* `prefix` (required): The prefix of the table/view (case insensitive) +* `exclude` (optional): Exclude any relations that match this pattern. +* `database` (optional, default = `target.database`): The database to inspect +for relations. + +#### get_query_results_as_dict ([source](macros/sql/get_query_results_as_dict.sql)) +This macro returns a dictionary from a sql query, so that you don't need to interact with the Agate library to operate on the result + +**Usage:** +``` +{% set sql_statement %} + select city, state from {{ ref('users') }} +{% endset %} + +{%- set places = dbt_utils.get_query_results_as_dict(sql_statement) -%} + +select + + {% for city in places['CITY'] | unique -%} + sum(case when city = '{{ city }}' then 1 else 0 end) as users_in_{{ dbt_utils.slugify(city) }}, + {% endfor %} + + {% for state in places['STATE'] | unique -%} + sum(case when state = '{{ state }}' then 1 else 0 end) as users_in_{{ state }}, + {% endfor %} + + count(*) as total_total + +from {{ ref('users') }} +``` + +### SQL generators +These macros generate SQL (either a complete query, or a part of a query). They often implement patterns that should be easy in SQL, but for some reason are much harder than they need to be. + +#### date_spine ([source](macros/sql/date_spine.sql)) +This macro returns the sql required to build a date spine. The spine will include the `start_date` (if it is aligned to the `datepart`), but it will not include the `end_date`. + +**Usage:** + +``` +{{ dbt_utils.date_spine( + datepart="day", + start_date="cast('2019-01-01' as date)", + end_date="cast('2020-01-01' as date)" + ) +}} +``` + +#### deduplicate ([source](macros/sql/deduplicate.sql)) +This macro returns the sql required to remove duplicate rows from a model, source, or CTE. + +**Args:** + - `relation` (required): a [Relation](https://docs.getdbt.com/reference/dbt-classes#relation) (a `ref` or `source`) or string which identifies the model to deduplicate. + - `partition_by` (required): column names (or expressions) to use to identify a set/window of rows out of which to select one as the deduplicated row. + - `order_by` (required): column names (or expressions) that determine the priority order of which row should be chosen if there are duplicates (comma-separated string). *NB.* if this order by clause results in ties then which row is returned may be nondeterministic across runs. + +**Usage:** + +``` +{{ dbt_utils.deduplicate( + relation=source('my_source', 'my_table'), + partition_by='user_id, cast(timestamp as day)', + order_by="timestamp desc", + ) +}} +``` + +``` +{{ dbt_utils.deduplicate( + relation=ref('my_model'), + partition_by='user_id', + order_by='effective_date desc, effective_sequence desc', + ) +}} +``` + +``` +with my_cte as ( + select * + from {{ source('my_source', 'my_table') }} + where user_id = 1 +) + +{{ dbt_utils.deduplicate( + relation='my_cte', + partition_by='user_id, cast(timestamp as day)', + order_by='timestamp desc', + ) +}} +``` + +#### haversine_distance ([source](macros/sql/haversine_distance.sql)) +This macro calculates the [haversine distance](http://daynebatten.com/2015/09/latitude-longitude-distance-sql/) between a pair of x/y coordinates. + +Optionally takes a `unit` string argument ('km' or 'mi') which defaults to miles (imperial system). + +**Usage:** + +``` +{{ dbt_utils.haversine_distance(48.864716, 2.349014, 52.379189, 4.899431) }} + +{{ dbt_utils.haversine_distance( + lat1=48.864716, + lon1=2.349014, + lat2=52.379189, + lon2=4.899431, + unit='km' +) }} +``` + +**Args:** +- `lat1` (required): latitude of first location +- `lon1` (required): longitude of first location +- `lat2` (required): latitude of second location +- `lon3` (required): longitude of second location +- `unit` (optional, default=`'mi'`): one of `mi` (miles) or `km` (kilometers) + +#### group_by ([source](macros/sql/groupby.sql)) +This macro build a group by statement for fields 1...N + +**Usage:** + +``` +{{ dbt_utils.group_by(n=3) }} +``` + +Would compile to: + +```sql +group by 1,2,3 +``` + +#### star ([source](macros/sql/star.sql)) +This macro generates a comma-separated list of all fields that exist in the `from` relation, excluding any fields +listed in the `except` argument. The construction is identical to `select * from {{ref('my_model')}}`, replacing star (`*`) with +the star macro. +This macro also has an optional `relation_alias` argument that will prefix all generated fields with an alias (`relation_alias`.`field_name`). +The macro also has optional `prefix` and `suffix` arguments. When one or both are provided, they will be concatenated onto each field's alias +in the output (`prefix` ~ `field_name` ~ `suffix`). NB: This prevents the output from being used in any context other than a select statement. + +**Args:** +- `from` (required): a [Relation](https://docs.getdbt.com/reference/dbt-classes#relation) (a `ref` or `source`) that contains the list of columns you wish to select from +- `except` (optional, default=`[]`): The name of the columns you wish to exclude. (case-insensitive) +- `relation_alias` (optional, default=`''`): will prefix all generated fields with an alias (`relation_alias`.`field_name`). +- `prefix` (optional, default=`''`): will prefix the output `field_name` (`field_name as prefix_field_name`). +- `suffix` (optional, default=`''`): will suffix the output `field_name` (`field_name as field_name_suffix`). + +**Usage:** +```sql +select + {{ dbt_utils.star(ref('my_model')) }} +from {{ ref('my_model') }} + +``` + +```sql +select +{{ dbt_utils.star(from=ref('my_model'), except=["exclude_field_1", "exclude_field_2"]) }} +from {{ ref('my_model') }} + +``` + +```sql +select +{{ dbt_utils.star(from=ref('my_model'), except=["exclude_field_1", "exclude_field_2"], prefix="max_") }} +from {{ ref('my_model') }} + +``` + +#### union_relations ([source](macros/sql/union.sql)) + +This macro unions together an array of [Relations](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation), +even when columns have differing orders in each Relation, and/or some columns are +missing from some relations. Any columns exclusive to a subset of these +relations will be filled with `null` where not present. A new column +(`_dbt_source_relation`) is also added to indicate the source for each record. + +**Usage:** +``` +{{ dbt_utils.union_relations( + relations=[ref('my_model'), source('my_source', 'my_table')], + exclude=["_loaded_at"] +) }} +``` + +**Args:** +* `relations` (required): An array of [Relations](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation). +* `exclude` (optional): A list of column names that should be excluded from +the final query. +* `include` (optional): A list of column names that should be included in the +final query. Note the `include` and `exclude` arguments are mutually exclusive. +* `column_override` (optional): A dictionary of explicit column type overrides, +e.g. `{"some_field": "varchar(100)"}`.`` +* `source_column_name` (optional, `default="_dbt_source_relation"`): The name of +the column that records the source of this row. +* `where` (optional): Filter conditions to include in the `where` clause. + +#### generate_series ([source](macros/sql/generate_series.sql)) +This macro implements a cross-database mechanism to generate an arbitrarily long list of numbers. Specify the maximum number you'd like in your list and it will create a 1-indexed SQL result set. + +**Usage:** +``` +{{ dbt_utils.generate_series(upper_bound=1000) }} +``` + +#### surrogate_key ([source](macros/sql/surrogate_key.sql)) +Implements a cross-database way to generate a hashed surrogate key using the fields specified. + +**Usage:** +``` +{{ dbt_utils.surrogate_key(['field_a', 'field_b'[,...]]) }} +``` + +#### safe_add ([source](macros/sql/safe_add.sql)) +Implements a cross-database way to sum nullable fields using the fields specified. + +**Usage:** +``` +{{ dbt_utils.safe_add('field_a', 'field_b'[,...]) }} +``` + +#### pivot ([source](macros/sql/pivot.sql)) +This macro pivots values from rows to columns. + +**Usage:** +``` +{{ dbt_utils.pivot(, ) }} +``` + +**Example:** + + Input: orders + + | size | color | + |------|-------| + | S | red | + | S | blue | + | S | red | + | M | red | + + select + size, + {{ dbt_utils.pivot( + 'color', + dbt_utils.get_column_values(ref('orders'), 'color') + ) }} + from {{ ref('orders') }} + group by size + + Output: + + | size | red | blue | + |------|-----|------| + | S | 2 | 1 | + | M | 1 | 0 | + +**Args:** +- `column`: Column name, required +- `values`: List of row values to turn into columns, required +- `alias`: Whether to create column aliases, default is True +- `agg`: SQL aggregation function, default is sum +- `cmp`: SQL value comparison, default is = +- `prefix`: Column alias prefix, default is blank +- `suffix`: Column alias postfix, default is blank +- `then_value`: Value to use if comparison succeeds, default is 1 +- `else_value`: Value to use if comparison fails, default is 0 +- `quote_identifiers`: Whether to surround column aliases with double quotes, default is true + +#### unpivot ([source](macros/sql/unpivot.sql)) +This macro "un-pivots" a table from wide format to long format. Functionality is similar to pandas [melt](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.melt.html) function. +Boolean values are replaced with the strings 'true'|'false' + +**Usage:** +``` +{{ dbt_utils.unpivot( + relation=ref('table_name'), + cast_to='datatype', + exclude=[], + remove=[], + field_name=, + value_name= +) }} +``` + +**Usage:** + + Input: orders + + | date | size | color | status | + |------------|------|-------|------------| + | 2017-01-01 | S | red | complete | + | 2017-03-01 | S | red | processing | + + {{ dbt_utils.unpivot(ref('orders'), cast_to='varchar', exclude=['date','status']) }} + + Output: + + | date | status | field_name | value | + |------------|------------|------------|-------| + | 2017-01-01 | complete | size | S | + | 2017-01-01 | complete | color | red | + | 2017-03-01 | processing | size | S | + | 2017-03-01 | processing | color | red | + +**Args:** +- `relation`: The [Relation](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation) to unpivot. +- `cast_to`: The data type to cast the unpivoted values to, default is varchar +- `exclude`: A list of columns to exclude from the unpivot operation but keep in the resulting table. +- `remove`: A list of columns to remove from the resulting table. +- `field_name`: column name in the resulting table for field +- `value_name`: column name in the resulting table for value + +### Web macros +#### get_url_parameter ([source](macros/web/get_url_parameter.sql)) +This macro extracts a url parameter from a column containing a url. + +**Usage:** +``` +{{ dbt_utils.get_url_parameter(field='page_url', url_parameter='utm_source') }} +``` + +#### get_url_host ([source](macros/web/get_url_host.sql)) +This macro extracts a hostname from a column containing a url. + +**Usage:** +``` +{{ dbt_utils.get_url_host(field='page_url') }} +``` + +#### get_url_path ([source](macros/web/get_url_path.sql)) +This macro extracts a page path from a column containing a url. + +**Usage:** +``` +{{ dbt_utils.get_url_path(field='page_url') }} +``` +---- +### Cross-database macros +These macros make it easier for package authors (especially those writing modeling packages) to implement cross-database +compatibility. In general, you should not use these macros in your own dbt project (unless it is a package) + +#### current_timestamp ([source](macros/cross_db_utils/current_timestamp.sql)) +This macro returns the current timestamp. + +**Usage:** +``` +{{ dbt_utils.current_timestamp() }} +``` + +#### dateadd ([source](macros/cross_db_utils/dateadd.sql)) +This macro adds a time/day interval to the supplied date/timestamp. Note: The `datepart` argument is database-specific. + +**Usage:** +``` +{{ dbt_utils.dateadd(datepart='day', interval=1, from_date_or_timestamp="'2017-01-01'") }} +``` + +#### datediff ([source](macros/cross_db_utils/datediff.sql)) +This macro calculates the difference between two dates. + +**Usage:** +``` +{{ dbt_utils.datediff("'2018-01-01'", "'2018-01-20'", 'day') }} +``` + +#### split_part ([source](macros/cross_db_utils/split_part.sql)) +This macro splits a string of text using the supplied delimiter and returns the supplied part number (1-indexed). + +**Args:** +- `string_text` (required): Text to be split into parts. +- `delimiter_text` (required): Text representing the delimiter to split by. +- `part_number` (required): Requested part of the split (1-based). If the value is negative, the parts are counted backward from the end of the string. + +**Usage:** +When referencing a column, use one pair of quotes. When referencing a string, use single quotes enclosed in double quotes. +``` +{{ dbt_utils.split_part(string_text='column_to_split', delimiter_text='delimiter_column', part_number=1) }} +{{ dbt_utils.split_part(string_text="'1|2|3'", delimiter_text="'|'", part_number=1) }} +``` + +#### date_trunc ([source](macros/cross_db_utils/date_trunc.sql)) +Truncates a date or timestamp to the specified datepart. Note: The `datepart` argument is database-specific. + +**Usage:** +``` +{{ dbt_utils.date_trunc(datepart, date) }} +``` + +#### last_day ([source](macros/cross_db_utils/last_day.sql)) +Gets the last day for a given date and datepart. Notes: + +- The `datepart` argument is database-specific. +- This macro currently only supports dateparts of `month` and `quarter`. + +**Usage:** +``` +{{ dbt_utils.last_day(date, datepart) }} +``` + +#### width_bucket ([source](macros/cross_db_utils/width_bucket.sql)) +This macro is modeled after the `width_bucket` function natively available in Snowflake. + +From the original Snowflake [documentation](https://docs.snowflake.net/manuals/sql-reference/functions/width_bucket.html): + +Constructs equi-width histograms, in which the histogram range is divided into intervals of identical size, and returns the bucket number into which the value of an expression falls, after it has been evaluated. The function returns an integer value or null (if any input is null). +Notes: + +**Args:** +- `expr`: The expression for which the histogram is created. This expression must evaluate to a numeric value or to a value that can be implicitly converted to a numeric value. + +- `min_value` and `max_value`: The low and high end points of the acceptable range for the expression. The end points must also evaluate to numeric values and not be equal. + +- `num_buckets`: The desired number of buckets; must be a positive integer value. A value from the expression is assigned to each bucket, and the function then returns the corresponding bucket number. + +When an expression falls outside the range, the function returns: +- `0` if the expression is less than min_value. +- `num_buckets + 1` if the expression is greater than or equal to max_value. + + +**Usage:** +``` +{{ dbt_utils.width_bucket(expr, min_value, max_value, num_buckets) }} +``` + +#### listagg ([source](macros/cross_db_utils/listagg.sql)) +This macro returns the concatenated input values from a group of rows separated by a specified deliminator. + +**Args:** +- `measure` (required): The expression (typically a column name) that determines the values to be concatenated. To only include distinct values add keyword DISTINCT to beginning of expression (example: 'DISTINCT column_to_agg'). +- `delimiter_text` (required): Text representing the delimiter to separate concatenated values by. +- `order_by_clause` (optional): An expression (typically a column name) that determines the order of the concatenated values. +- `limit_num` (optional): Specifies the maximum number of values to be concatenated. + +Note: If there are instances of `delimiter_text` within your `measure`, you cannot include a `limit_num`. + +**Usage:** +``` +{{ dbt_utils.listagg(measure='column_to_agg', delimiter_text="','", order_by_clause="order by order_by_column", limit_num=10) }} +``` + +#### array_construct ([source](macros/cross_db_utils/array_construct.sql)) +This macro returns an array constructed from a set of inputs. + +**Args:** +- `inputs` (optional): The list of array contents. If not provided, this macro will create an empty array. All inputs must be the *same data type* in order to match Postgres functionality and *not null* to match Bigquery functionality. +- `data_type` (optional): Specifies the data type of the constructed array. This is only relevant when creating an empty array (will otherwise use the data type of the inputs). If `inputs` are `data_type` are both not provided, this macro will create an empty array of type integer. + +**Usage:** +``` +{{ dbt_utils.array_construct(['column_1', 'column_2', 'column_3']) }} +{{ dbt_utils.array_construct([],'integer') }} +``` + +#### array_append ([source](macros/cross_db_utils/array_append.sql)) +This macro appends an element to the end of an array and returns the appended array. + +**Args:** +- `array` (required): The array to append to. +- `new_element` (required): The element to be appended. This element must *match the data type of the existing elements* in the array in order to match Postgres functionality and *not null* to match Bigquery functionality. + +**Usage:** +``` +{{ dbt_utils.array_append('array_column', 'element_column') }} +``` + +#### array_concat ([source](macros/cross_db_utils/array_concat.sql)) +This macro returns the concatenation of two arrays. + +**Args:** +- `array_1` (required): The array to append to. +- `array_2` (required): The array to be appended to `array_1`. This array must match the data type of `array_1` in order to match Postgres functionality. + +**Usage:** +``` +{{ dbt_utils.array_concat('array_column_1', 'array_column_2') }} +``` + +#### cast_array_to_string ([source](macros/cross_db_utils/cast_array_to_string.sql)) +This macro converts an array to a single string value and returns the resulting string. + +**Args:** +- `array` (required): The array to convert to a string. + +**Usage:** +``` +{{ dbt_utils.cast_array_to_string('array_column') }} +``` + +--- +### Jinja Helpers +#### pretty_time ([source](macros/jinja_helpers/pretty_time.sql)) +This macro returns a string of the current timestamp, optionally taking a datestring format. +```sql +{#- This will return a string like '14:50:34' -#} +{{ dbt_utils.pretty_time() }} + +{#- This will return a string like '2019-05-02 14:50:34' -#} +{{ dbt_utils.pretty_time(format='%Y-%m-%d %H:%M:%S') }} +``` + +#### pretty_log_format ([source](macros/jinja_helpers/pretty_log_format.sql)) +This macro formats the input in a way that will print nicely to the command line when you `log` it. +```sql +{#- This will return a string like: +"11:07:31 + my pretty message" +-#} + +{{ dbt_utils.pretty_log_format("my pretty message") }} +``` +#### log_info ([source](macros/jinja_helpers/log_info.sql)) +This macro logs a formatted message (with a timestamp) to the command line. +```sql +{{ dbt_utils.log_info("my pretty message") }} +``` + +``` +11:07:28 | 1 of 1 START table model analytics.fct_orders........................ [RUN] +11:07:31 + my pretty message +``` + +#### slugify ([source](macros/jinja_helpers/slugify.sql)) +This macro is useful for transforming Jinja strings into "slugs", and can be useful when using a Jinja object as a column name, especially when that Jinja object is not hardcoded. + +For this example, let's pretend that we have payment methods in our payments table like `['venmo App', 'ca$h-money']`, which we can't use as a column name due to the spaces and special characters. This macro does its best to strip those out in a sensible way: `['venmo_app', +'cah_money']`. + +```sql +{%- set payment_methods = dbt_utils.get_column_values( + table=ref('raw_payments'), + column='payment_method' +) -%} + +select +order_id, +{%- for payment_method in payment_methods %} +sum(case when payment_method = '{{ payment_method }}' then amount end) + as {{ dbt_utils.slugify(payment_method) }}_amount, + +{% endfor %} +... +``` + +```sql +select +order_id, + +sum(case when payment_method = 'Venmo App' then amount end) + as venmo_app_amount, + +sum(case when payment_method = 'ca$h money' then amount end) + as cah_money_amount, +... +``` + +### Materializations +#### insert_by_period ([source](macros/materializations/insert_by_period_materialization.sql)) +`insert_by_period` allows dbt to insert records into a table one period (i.e. day, week) at a time. + +This materialization is appropriate for event data that can be processed in discrete periods. It is similar in concept to the built-in incremental materialization, but has the added benefit of building the model in chunks even during a full-refresh so is particularly useful for models where the initial run can be problematic. + +Should a run of a model using this materialization be interrupted, a subsequent run will continue building the target table from where it was interrupted (granted the `--full-refresh` flag is omitted). + +Progress is logged in the command line for easy monitoring. + +**Usage:** +```sql +{{ + config( + materialized = "insert_by_period", + period = "day", + timestamp_field = "created_at", + start_date = "2018-01-01", + stop_date = "2018-06-01") +}} + +with events as ( + + select * + from {{ ref('events') }} + where __PERIOD_FILTER__ -- This will be replaced with a filter in the materialization code + +) + +....complex aggregates here.... + +``` + +**Configuration values:** +* `period`: period to break the model into, must be a valid [datepart](https://docs.aws.amazon.com/redshift/latest/dg/r_Dateparts_for_datetime_functions.html) (default='Week') +* `timestamp_field`: the column name of the timestamp field that will be used to break the model into smaller queries +* `start_date`: literal date or timestamp - generally choose a date that is earlier than the start of your data +* `stop_date`: literal date or timestamp (default=current_timestamp) + +**Caveats:** +* This materialization is compatible with dbt 0.10.1. +* This materialization has been written for Redshift. +* This materialization can only be used for a model where records are not expected to change after they are created. +* Any model post-hooks that use `{{ this }}` will fail using this materialization. For example: +```yaml +models: + project-name: + post-hook: "grant select on {{ this }} to db_reader" +``` +A useful workaround is to change the above post-hook to: +```yaml + post-hook: "grant select on {{ this.schema }}.{{ this.name }} to db_reader" +``` + +---- + +### Reporting bugs and contributing code + +- Want to report a bug or request a feature? Let us know in the `#package-ecosystem` channel on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-utils/issues/new) +- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-utils/dbt-core/blob/HEAD/CONTRIBUTING.md) + - **TL;DR** Open a Pull Request with 1) your changes, 2) updated documentation for the `README.md` file, and 3) a working integration test. + +---- + +### Dispatch macros + +**Note:** This is primarily relevant to: +- Users and maintainers of community-supported [adapter plugins](https://docs.getdbt.com/docs/available-adapters) +- Users who wish to override a low-lying `dbt_utils` macro with a custom implementation, and have that implementation used by other `dbt_utils` macros + +If you use Postgres, Redshift, Snowflake, or Bigquery, this likely does not apply to you. + +dbt v0.18.0 introduced [`adapter.dispatch()`](https://docs.getdbt.com/reference/dbt-jinja-functions/adapter#dispatch), a reliable way to define different implementations of the same macro across different databases. + +dbt v0.20.0 introduced a new project-level `dispatch` config that enables an "override" setting for all dispatched macros. If you set this config in your project, when dbt searches for implementations of a macro in the `dbt_utils` namespace, it will search through your list of packages instead of just looking in the `dbt_utils` package. + +Set the config in `dbt_project.yml`: +```yml +dispatch: + - macro_namespace: dbt_utils + search_order: + - first_package_to_search # likely the name of your root project + - second_package_to_search # could be a "shim" package, such as spark_utils + - dbt_utils # always include dbt_utils as the last place to search +``` + +If overriding a dispatched macro with a custom implementation in your own project's `macros/` directory, you must name your custom macro with a prefix: either `default__` (note the two underscores), or the name of your adapter followed by two underscores. For example, if you're running on Postgres and wish to override the behavior of `dbt_utils.datediff` (such that `dbt_utils.date_spine` will use your version instead), you can do this by defining a macro called either `default__datediff` or `postgres__datediff`. + +Let's say we have the config defined above, and we're running on Spark. When dbt goes to dispatch `dbt_utils.datediff`, it will search for macros the following in order: +``` +first_package_to_search.spark__datediff +first_package_to_search.default__datediff +second_package_to_search.spark__datediff +second_package_to_search.default__datediff +dbt_utils.spark__datediff +dbt_utils.default__datediff +``` + +---- + +### Getting started with dbt + +- [What is dbt](https://docs.getdbt.com/docs/introduction)? +- Read the [dbt viewpoint](https://docs.getdbt.com/docs/about/viewpoint) +- [Installation](https://docs.getdbt.com/dbt-cli/installation) +- Join the [chat](https://www.getdbt.com/community/) on Slack for live questions and support. + + +## Code of Conduct + +Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [PyPA Code of Conduct]. + + + +[PyPA Code of Conduct]: https://www.pypa.io/en/latest/code-of-conduct/ +[slack-url]: http://ac-slackin.herokuapp.com/ +[Installation]: https://dbt.readme.io/docs/installation +[What is dbt]: https://dbt.readme.io/docs/overview +[dbt viewpoint]: https://dbt.readme.io/docs/viewpoint diff --git a/dbt_packages/dbt_utils/RELEASE.md b/dbt_packages/dbt_utils/RELEASE.md new file mode 100644 index 0000000..f23396f --- /dev/null +++ b/dbt_packages/dbt_utils/RELEASE.md @@ -0,0 +1,35 @@ +# dbt-utils releases + +## When do we release? +There's a few scenarios that might prompt a release: + +| Scenario | Release type | +|--------------------------------------------|--------------| +| New functionality¹ | minor | +| Breaking changes to existing macros | minor | +| Fixes to existing macros | patch | +| dbt minor release with no breaking changes | patch | +| dbt minor release with breaking changes | minor | + +¹New macros were previously considered patch releases — we have brought them up to minor releases to make versioning for dependencies clearer. + +## Branching strategy + +At any point, there should be two long-lived branches: +- `master` (default): This reflects the most recent release of dbt-utils +- `dev/0.x.0`: This reflects the next minor release, where `x` will be replaced with the minor version number + +The `dev/0.x.0` branch should be merged into `master` branch when new releases are created. + +## Process for minor releases +e.g. for releasing `0.x.0` +1. Create the PR to merge `dev/0.x.0` into `master`. Also update the `Changelog` as part of this PR, and merge it. +2. Create the GitHub release from the `master` branch. +3. Delete the `dev/0.x.0` branch, and create a new branch `dev/0.x+1.0` from `master`, adding branch protection to it. +4. [Create a new issue](https://github.com/fishtown-analytics/dbt-utils/issues/new/choose) from the "dbt-utils Minor Release Follow-Up" template to also update any dependencies. + +## Process for patch releases +1. Create the release. +2. Then rebase the current `dev/0.x.0` branch on top of the `master` branch so that any fixes will be included in the next minor release. + +No dependent packages need to be updated for patch releases (e.g. codegen, audit-helper) diff --git a/dbt_packages/dbt_utils/dbt_project.yml b/dbt_packages/dbt_utils/dbt_project.yml new file mode 100644 index 0000000..833501d --- /dev/null +++ b/dbt_packages/dbt_utils/dbt_project.yml @@ -0,0 +1,11 @@ +name: 'dbt_utils' +version: '0.1.0' + +require-dbt-version: [">=1.0.0", "<2.0.0"] + +config-version: 2 + +target-path: "target" +clean-targets: ["target", "dbt_modules", "dbt_packages"] +macro-paths: ["macros"] +log-path: "logs" diff --git a/dbt_packages/dbt_utils/dev-requirements.txt b/dbt_packages/dbt_utils/dev-requirements.txt new file mode 100644 index 0000000..92c0787 --- /dev/null +++ b/dbt_packages/dbt_utils/dev-requirements.txt @@ -0,0 +1,3 @@ +pytest +pytest-dotenv +dbt-tests-adapter diff --git a/dbt_packages/dbt_utils/doc/arch/README.md b/dbt_packages/dbt_utils/doc/arch/README.md new file mode 100644 index 0000000..3f65adb --- /dev/null +++ b/dbt_packages/dbt_utils/doc/arch/README.md @@ -0,0 +1,4 @@ +## ADRs + +For any architectural/engineering decisions we make, we will create an [ADR (Architectural Design Record)](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions) to keep track of what decision we made and why. This allows us to refer back to decisions in the future and see if the reasons we made a choice still holds true. This also allows for others to more easily understand the code. ADRs will follow this process (or its replacement): +- [adr-000-documenting-architecture-decisions.md](adr-000-documenting-architecture-decisions.md) diff --git a/dbt_packages/dbt_utils/doc/arch/adr-000-documenting-architecture-decisions.md b/dbt_packages/dbt_utils/doc/arch/adr-000-documenting-architecture-decisions.md new file mode 100644 index 0000000..214d0f0 --- /dev/null +++ b/dbt_packages/dbt_utils/doc/arch/adr-000-documenting-architecture-decisions.md @@ -0,0 +1,60 @@ +Source: https://www.cognitect.com/blog/2011/11/15/documenting-architecture-decisions + +# DOCUMENTING ARCHITECTURE DECISIONS +Michael Nygard - November 15, 2011 + +## CONTEXT +Architecture for agile projects has to be described and defined differently. Not all decisions will be made at once, nor will all of them be done when the project begins. + +Agile methods are not opposed to documentation, only to valueless documentation. Documents that assist the team itself can have value, but only if they are kept up to date. Large documents are never kept up to date. Small, modular documents have at least a chance at being updated. + +Nobody ever reads large documents, either. Most developers have been on at least one project where the specification document was larger (in bytes) than the total source code size. Those documents are too large to open, read, or update. Bite sized pieces are easier for for all stakeholders to consume. + +One of the hardest things to track during the life of a project is the motivation behind certain decisions. A new person coming on to a project may be perplexed, baffled, delighted, or infuriated by some past decision. Without understanding the rationale or consequences, this person has only two choices: + +1. **Blindly accept the decision.** +This response may be OK, if the decision is still valid. It may not be good, however, if the context has changed and the decision should really be revisited. If the project accumulates too many decisions accepted without understanding, then the development team becomes afraid to change anything and the project collapses under its own weight. + +2. **Blindly change it.** +Again, this may be OK if the decision needs to be reversed. On the other hand, changing the decision without understanding its motivation or consequences could mean damaging the project's overall value without realizing it. (E.g., the decision supported a non-functional requirement that hasn't been tested yet.) + +It's better to avoid either blind acceptance or blind reversal. + +## DECISION +We will keep a collection of records for "architecturally significant" decisions: those that affect the structure, non-functional characteristics, dependencies, interfaces, or construction techniques. + +An architecture decision record is a short text file in a format similar to an Alexandrian pattern. (Though the decisions themselves are not necessarily patterns, they share the characteristic balancing of forces.) Each record describes a set of forces and a single decision in response to those forces. Note that the decision is the central piece here, so specific forces may appear in multiple ADRs. + +We will keep ADRs in the project repository under doc/arch/adr-NNN.md + +We should use a lightweight text formatting language like Markdown or Textile. + +ADRs will be numbered sequentially and monotonically. Numbers will not be reused. + +If a decision is reversed, we will keep the old one around, but mark it as superseded. (It's still relevant to know that it was the decision, but is no longer the decision.) + +We will use a format with just a few parts, so each document is easy to digest. The format has just a few parts. + +**Title** These documents have names that are short noun phrases. For example, "ADR 1: Deployment on Ruby on Rails 3.0.10" or "ADR 9: LDAP for Multitenant Integration" + +**Context** This section describes the forces at play, including technological, political, social, and project local. These forces are probably in tension, and should be called out as such. The language in this section is value-neutral. It is simply describing facts. + +**Decision** This section describes our response to these forces. It is stated in full sentences, with active voice. "We will …" + +**Status** A decision may be "proposed" if the project stakeholders haven't agreed with it yet, or "accepted" once it is agreed. If a later ADR changes or reverses a decision, it may be marked as "deprecated" or "superseded" with a reference to its replacement. + +**Consequences** This section describes the resulting context, after applying the decision. All consequences should be listed here, not just the "positive" ones. A particular decision may have positive, negative, and neutral consequences, but all of them affect the team and project in the future. + +The whole document should be one or two pages long. We will write each ADR as if it is a conversation with a future developer. This requires good writing style, with full sentences organized into paragraphs. Bullets are acceptable only for visual style, not as an excuse for writing sentence fragments. (Bullets kill people, even PowerPoint bullets.) + +## STATUS +Accepted. + +## CONSEQUENCES +One ADR describes one significant decision for a specific project. It should be something that has an effect on how the rest of the project will run. + +The consequences of one ADR are very likely to become the context for subsequent ADRs. This is also similar to Alexander's idea of a pattern language: the large-scale responses create spaces for the smaller scale to fit into. + +Developers and project stakeholders can see the ADRs, even as the team composition changes over time. + +The motivation behind previous decisions is visible for everyone, present and future. Nobody is left scratching their heads to understand, "What were they thinking?" and the time to change old decisions will be clear from changes in the project's context. diff --git a/dbt_packages/dbt_utils/docker-compose.yml b/dbt_packages/dbt_utils/docker-compose.yml new file mode 100644 index 0000000..6957ffe --- /dev/null +++ b/dbt_packages/dbt_utils/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.7" +services: + postgres: + image: cimg/postgres:9.6 + environment: + - POSTGRES_USER=root + ports: + - "5432:5432" diff --git a/dbt_packages/dbt_utils/etc/dbt-logo.png b/dbt_packages/dbt_utils/etc/dbt-logo.png new file mode 100644 index 0000000..b3112c0 Binary files /dev/null and b/dbt_packages/dbt_utils/etc/dbt-logo.png differ diff --git a/dbt_packages/dbt_utils/integration_tests/.env/bigquery.env b/dbt_packages/dbt_utils/integration_tests/.env/bigquery.env new file mode 100644 index 0000000..9d8c297 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/.env/bigquery.env @@ -0,0 +1,2 @@ +BIGQUERY_SERVICE_KEY_PATH= +BIGQUERY_TEST_DATABASE= \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/.env/postgres.env b/dbt_packages/dbt_utils/integration_tests/.env/postgres.env new file mode 100644 index 0000000..c3f7dd8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/.env/postgres.env @@ -0,0 +1,5 @@ +POSTGRES_TEST_HOST=localhost +POSTGRES_TEST_USER=root +POSTGRES_TEST_PASS='' +POSTGRES_TEST_PORT=5432 +POSTGRES_TEST_DBNAME=circle_test diff --git a/dbt_packages/dbt_utils/integration_tests/.env/redshift.env b/dbt_packages/dbt_utils/integration_tests/.env/redshift.env new file mode 100644 index 0000000..77378d5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/.env/redshift.env @@ -0,0 +1,5 @@ +REDSHIFT_TEST_HOST= +REDSHIFT_TEST_USER= +REDSHIFT_TEST_PASS= +REDSHIFT_TEST_DBNAME= +REDSHIFT_TEST_PORT= \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/.env/snowflake.env b/dbt_packages/dbt_utils/integration_tests/.env/snowflake.env new file mode 100644 index 0000000..134cc8d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/.env/snowflake.env @@ -0,0 +1,6 @@ +SNOWFLAKE_TEST_ACCOUNT= +SNOWFLAKE_TEST_USER= +SNOWFLAKE_TEST_PASSWORD= +SNOWFLAKE_TEST_ROLE= +SNOWFLAKE_TEST_DATABASE= +SNOWFLAKE_TEST_WAREHOUSE= \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/.gitignore b/dbt_packages/dbt_utils/integration_tests/.gitignore new file mode 100644 index 0000000..638c8c4 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/.gitignore @@ -0,0 +1,6 @@ + +target/ +dbt_modules/ +logs/ +.env/ +profiles.yml diff --git a/dbt_packages/dbt_utils/integration_tests/README.md b/dbt_packages/dbt_utils/integration_tests/README.md new file mode 100644 index 0000000..8dda2c7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/README.md @@ -0,0 +1,132 @@ +### Overview +1. Prerequisites +1. Configure credentials +1. Setup Postgres (optional) +1. Setup virtual environment +1. Installation for development +1. Run the integration tests +1. Run tests +1. Creating a new integration test + +### Prerequisites +- python3 +- Docker + +### Configure credentials +Edit the env file for your TARGET in `integration_tests/.env/[TARGET].env`. + +Load the environment variables: +```shell +set -a; source integration_tests/.env/[TARGET].env; set +a +``` + +or more specific: +```shell +set -a; source integration_tests/.env/postgres.env; set +a +``` + +#### Setup Postgres (optional) + +Docker and `docker-compose` are both used in testing. Specific instructions for your OS can be found [here](https://docs.docker.com/get-docker/). + +Postgres offers the easiest way to test most `dbt-utils` functionality today. Its tests are the fastest to run, and the easiest to set up. To run the Postgres integration tests, you'll have to do one extra step of setting up the test database: + +```shell +make setup-db +``` +or, alternatively: +```shell +docker-compose up --detach postgres +``` + +### Setup virtual environment + +We strongly recommend using virtual environments when developing code in `dbt-utils`. We recommend creating this virtualenv +in the root of the `dbt-utils` repository. To create a new virtualenv, run: +```shell +python3 -m venv env +source env/bin/activate +``` + +This will create and activate a new Python virtual environment. + +### Installation for development + +First make sure that you set up your virtual environment as described above. Also ensure you have the latest version of pip installed with `pip install --upgrade pip`. Next, install `dbt-core` (and its dependencies) with: + +```shell +make dev target=[postgres|redshift|...] +# or +pip install --pre dbt-[postgres|redshift|...] -r dev-requirements.txt +``` + +or more specific: + +```shell +make dev target=postgres +# or +pip install --pre dbt-postgres -r dev-requirements.txt +``` + +### Run the integration tests + +To run all the integration tests on your local machine like they will get run in the CI (using CircleCI): + +```shell +make test target=postgres +``` + +or, to run tests for a single model: +```shell +make test target=[postgres|redshift|...] [models=...] [seeds=...] +``` + +or more specific: + +```shell +make test target=postgres models=sql.test_star seeds=sql.data_star +``` + +Specying `models=` and `seeds=` is optional, however _if_ you specify `seeds`, you have to specify `models` too. + +Where possible, targets are being run in docker containers (this works for Postgres or in the future Spark for example). For managed services like Snowflake, BigQuery and Redshift this is not possible, hence your own configuration for these services has to be provided in the appropriate env files in `integration_tests/.env/[TARGET].env` + +### Creating a new integration test + +#### Set up profiles +Do either one of the following: +1. Use `DBT_PROFILES_DIR` + ```shell + cp integration_tests/ci/sample.profiles.yml integration_tests/profiles.yml + export DBT_PROFILES_DIR=$(cd integration_tests && pwd) + ``` +2. Use `~/.dbt/profiles.yml` + - Copy contents from `integration_tests/ci/sample.profiles.yml` into `~/.dbt/profiles.yml`. + +#### Add your integration test +This directory contains an example dbt project which tests the macros in the `dbt-utils` package. An integration test typically involves making 1) a new seed file 2) a new model file 3) a generic test to assert anticipated behaviour. + +For an example integration tests, check out the tests for the `get_url_parameter` macro: + +1. [Macro definition](https://github.com/fishtown-analytics/dbt-utils/blob/master/macros/web/get_url_parameter.sql) +2. [Seed file with fake data](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/data/web/data_urls.csv) +3. [Model to test the macro](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/models/web/test_urls.sql) +4. [A generic test to assert the macro works as expected](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/models/web/schema.yml#L2) + +Once you've added all of these files, you should be able to run: + +Assuming you are in the `integration_tests` folder, +```shell +dbt deps --target {your_target} +dbt seed --target {your_target} +dbt run --target {your_target} --model {your_model_name} +dbt test --target {your_target} --model {your_model_name} +``` + +Alternatively: +```shell +dbt deps --target {your_target} +dbt build --target {your_target} --select +{your_model_name} +``` + +If the tests all pass, then you're good to go! All tests will be run automatically when you create a PR against this repo. \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/ci/sample.profiles.yml b/dbt_packages/dbt_utils/integration_tests/ci/sample.profiles.yml new file mode 100644 index 0000000..d3a6179 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/ci/sample.profiles.yml @@ -0,0 +1,49 @@ + +# HEY! This file is used in the dbt-utils integrations tests with CircleCI. +# You should __NEVER__ check credentials into version control. Thanks for reading :) + +config: + send_anonymous_usage_stats: False + use_colors: True + +integration_tests: + target: postgres + outputs: + postgres: + type: postgres + host: "{{ env_var('POSTGRES_TEST_HOST') }}" + user: "{{ env_var('POSTGRES_TEST_USER') }}" + pass: "{{ env_var('POSTGRES_TEST_PASS') }}" + port: "{{ env_var('POSTGRES_TEST_PORT') | as_number }}" + dbname: "{{ env_var('POSTGRES_TEST_DBNAME') }}" + schema: dbt_utils_integration_tests_postgres + threads: 5 + + redshift: + type: redshift + host: "{{ env_var('REDSHIFT_TEST_HOST') }}" + user: "{{ env_var('REDSHIFT_TEST_USER') }}" + pass: "{{ env_var('REDSHIFT_TEST_PASS') }}" + dbname: "{{ env_var('REDSHIFT_TEST_DBNAME') }}" + port: "{{ env_var('REDSHIFT_TEST_PORT') | as_number }}" + schema: dbt_utils_integration_tests_redshift + threads: 5 + + bigquery: + type: bigquery + method: service-account + keyfile: "{{ env_var('BIGQUERY_SERVICE_KEY_PATH') }}" + project: "{{ env_var('BIGQUERY_TEST_DATABASE') }}" + schema: dbt_utils_integration_tests_bigquery + threads: 10 + + snowflake: + type: snowflake + account: "{{ env_var('SNOWFLAKE_TEST_ACCOUNT') }}" + user: "{{ env_var('SNOWFLAKE_TEST_USER') }}" + password: "{{ env_var('SNOWFLAKE_TEST_PASSWORD') }}" + role: "{{ env_var('SNOWFLAKE_TEST_ROLE') }}" + database: "{{ env_var('SNOWFLAKE_TEST_DATABASE') }}" + warehouse: "{{ env_var('SNOWFLAKE_TEST_WAREHOUSE') }}" + schema: dbt_utils_integration_tests_snowflake + threads: 10 diff --git a/dbt_packages/dbt_utils/integration_tests/data/.gitkeep b/dbt_packages/dbt_utils/integration_tests/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_any_value_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_any_value_expected.csv new file mode 100644 index 0000000..95e6aef --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_any_value_expected.csv @@ -0,0 +1,4 @@ +key_name,static_col,num_rows +abc,dbt,2 +jkl,dbt,3 +xyz,test,1 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_append.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_append.csv new file mode 100644 index 0000000..46dda68 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_append.csv @@ -0,0 +1,2 @@ +array_as_string,element,result_as_string +"[1,2,3]",4,"[1,2,3,4]" \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_concat.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_concat.csv new file mode 100644 index 0000000..0eda79c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_concat.csv @@ -0,0 +1,2 @@ +array_1_as_string,array_2_as_string,result_as_string +"[1,2,3]","[4,5,6]","[1,2,3,4,5,6]" \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_construct.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_construct.csv new file mode 100644 index 0000000..fe76c47 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_array_construct.csv @@ -0,0 +1,3 @@ +num_input_1,num_input_2,num_input_3,result_as_string +1,2,3,"[1,2,3]" +4,5,6,"[4,5,6]" \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or.csv new file mode 100644 index 0000000..97ea2ab --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or.csv @@ -0,0 +1,8 @@ +key,val1,val2 +abc,1,1 +abc,1,0 +def,1,0 +hij,1,1 +hij,1, +klm,1,0 +klm,1, \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or_expected.csv new file mode 100644 index 0000000..14f6e92 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_bool_or_expected.csv @@ -0,0 +1,5 @@ +key,value +abc,true +def,false +hij,true +klm,false \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_cast_bool_to_text b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_cast_bool_to_text new file mode 100644 index 0000000..23090b8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_cast_bool_to_text @@ -0,0 +1,4 @@ +id,my_bool +1,true +2,false +3, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_concat.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_concat.csv new file mode 100644 index 0000000..eae83aa --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_concat.csv @@ -0,0 +1,5 @@ +input_1,input_2,output +a,b,ab +a,,a +,b,b +,, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_date_trunc.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_date_trunc.csv new file mode 100644 index 0000000..cff7297 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_date_trunc.csv @@ -0,0 +1,3 @@ +updated_at,day,month +2018-01-05 12:00:00,2018-01-05,2018-01-01 +,, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_dateadd.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_dateadd.csv new file mode 100644 index 0000000..a071c5f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_dateadd.csv @@ -0,0 +1,6 @@ +from_time,interval_length,datepart,result +2018-01-01 01:00:00,1,day,2018-01-02 01:00:00 +2018-01-01 01:00:00,1,month,2018-02-01 01:00:00 +2018-01-01 01:00:00,1,year,2019-01-01 01:00:00 +2018-01-01 01:00:00,1,hour,2018-01-01 02:00:00 +,1,day, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_datediff.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_datediff.csv new file mode 100644 index 0000000..57b0da4 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_datediff.csv @@ -0,0 +1,13 @@ +first_date,second_date,datepart,result +2018-01-01 01:00:00,2018-01-02 01:00:00,day,1 +2018-01-01 01:00:00,2018-02-01 01:00:00,month,1 +2018-01-01 01:00:00,2019-01-01 01:00:00,year,1 +2018-01-01 01:00:00,2018-01-01 02:00:00,hour,1 +2018-01-01 01:00:00,2018-01-01 02:01:00,minute,61 +2018-01-01 01:00:00,2018-01-01 02:00:01,second,3601 +2019-12-31 00:00:00,2019-12-27 00:00:00,week,-1 +2019-12-31 00:00:00,2019-12-30 00:00:00,week,0 +2019-12-31 00:00:00,2020-01-02 00:00:00,week,0 +2019-12-31 00:00:00,2020-01-06 02:00:00,week,1 +,2018-01-01 02:00:00,hour, +2018-01-01 02:00:00,,hour, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_hash.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_hash.csv new file mode 100644 index 0000000..cdae9ad --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_hash.csv @@ -0,0 +1,5 @@ +input_1,output +ab,187ef4436122d1cc2f40dc2b92f0eba0 +a,0cc175b9c0f1b6a831c399e269772661 +1,c4ca4238a0b923820dcc509a6f75849b +,d41d8cd98f00b204e9800998ecf8427e diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_last_day.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_last_day.csv new file mode 100644 index 0000000..307fbeb --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_last_day.csv @@ -0,0 +1,5 @@ +date_day,date_part,result +2018-01-02,month,2018-01-31 +2018-01-02,quarter,2018-03-31 +2018-01-02,year,2018-12-31 +,month, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_length.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_length.csv new file mode 100644 index 0000000..e60a82a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_length.csv @@ -0,0 +1,5 @@ +expression,output +abcdef,6 +fishtown,8 +december,8 +www.google.com/path,19 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg.csv new file mode 100644 index 0000000..ee5083b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg.csv @@ -0,0 +1,10 @@ +group_col,string_text,order_col +1,a,1 +1,b,2 +1,c,3 +2,a,2 +2,1,1 +2,p,3 +3,g,1 +3,g,2 +3,g,3 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg_output.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg_output.csv new file mode 100644 index 0000000..a7e1c6c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_listagg_output.csv @@ -0,0 +1,10 @@ +group_col,expected,version +1,"a_|_b_|_c",bottom_ordered +2,"1_|_a_|_p",bottom_ordered +3,"g_|_g_|_g",bottom_ordered +1,"a_|_b",bottom_ordered_limited +2,"1_|_a",bottom_ordered_limited +3,"g_|_g",bottom_ordered_limited +3,"g, g, g",comma_whitespace_unordered +3,"g",distinct_comma +3,"g,g,g",no_params \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_position.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_position.csv new file mode 100644 index 0000000..07003ea --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_position.csv @@ -0,0 +1,5 @@ +substring_text,string_text,result +def,abcdef,4 +land,earth,0 +town,fishtown,5 +ember,december,4 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_replace.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_replace.csv new file mode 100644 index 0000000..389825c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_replace.csv @@ -0,0 +1,3 @@ +string_text,search_chars,replace_chars,result +a,a,b,b +http://google.com,http://,"",google.com \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_right.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_right.csv new file mode 100644 index 0000000..63af8e6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_right.csv @@ -0,0 +1,5 @@ +string_text,length_expression,output +abcdef,3,def +fishtown,4,town +december,5,ember +december,0, \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_safe_cast.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_safe_cast.csv new file mode 100644 index 0000000..dedb730 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_safe_cast.csv @@ -0,0 +1,4 @@ +field,output +abc,abc +123,123 +, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_split_part.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_split_part.csv new file mode 100644 index 0000000..9c9a31a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_split_part.csv @@ -0,0 +1,4 @@ +parts,split_on,result_1,result_2,result_3 +a|b|c,|,a,b,c +1|2|3,|,1,2,3 +,|,,, diff --git a/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_width_bucket.csv b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_width_bucket.csv new file mode 100644 index 0000000..6a8906d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/cross_db/data_width_bucket.csv @@ -0,0 +1,9 @@ +date_col,amount,num_buckets,min_value,max_value,bucket +2012-08-01,190000.00,4,200000.0,600000.0,0 +2013-08-01,290000.00,4,200000.0,600000.0,1 +2014-02-01,320000.00,4,200000.0,600000.0,2 +2015-04-01,399999.99,4,200000.0,600000.0,2 +2016-04-01,400000.00,4,200000.0,600000.0,3 +2017-04-01,470000.00,4,200000.0,600000.0,3 +2018-04-01,510000.00,4,200000.0,600000.0,4 +2019-04-01,610000.00,4,200000.0,600000.0,5 diff --git a/dbt_packages/dbt_utils/integration_tests/data/datetime/data_date_spine.csv b/dbt_packages/dbt_utils/integration_tests/data/datetime/data_date_spine.csv new file mode 100644 index 0000000..e5819c8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/datetime/data_date_spine.csv @@ -0,0 +1,10 @@ +date_day +2018-01-01 +2018-01-02 +2018-01-03 +2018-01-04 +2018-01-05 +2018-01-06 +2018-01-07 +2018-01-08 +2018-01-09 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/etc/data_people.csv b/dbt_packages/dbt_utils/integration_tests/data/etc/data_people.csv new file mode 100644 index 0000000..9027383 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/etc/data_people.csv @@ -0,0 +1,101 @@ +id,first_name,last_name,email,ip_address,created_at,is_active +1,Dame,Cluley,dcluley0@nih.gov,155.86.204.241,2017-02-07 09:48:26,false +2,Guy,Wittering,gwittering1@reddit.com,221.174.176.36,2017-08-08 00:37:53,false +3,Klement,Bucke,kbucke2@dedecms.com,167.94.85.199,2016-09-05 23:43:19,true +4,Roselia,Dallander,rdallander3@adobe.com,135.10.21.248,2016-08-11 00:00:11,false +5,Arly,Terzza,aterzza4@va.gov,219.66.192.10,2017-03-23 22:11:42,true +6,Arron,Siehard,asiehard5@ibm.com,116.211.108.88,2017-07-07 23:11:50,true +7,Debera,Petrazzi,dpetrazzi6@addthis.com,18.167.49.108,2017-11-12 04:34:50,false +8,Timi,Agget,tagget7@home.pl,170.171.78.217,2016-03-14 02:04:33,true +9,Ines,Brixey,ibrixey8@biblegateway.com,251.141.4.42,2017-10-01 16:41:21,false +10,Karlen,Eggleton,keggleton9@amazon.co.jp,100.179.149.224,2016-04-15 10:05:00,true +11,Hamish,Winfield,hwinfielda@squarespace.com,5.34.205.16,2017-12-29 22:44:52,true +12,Stanton,Tiron,stironb@rambler.ru,171.5.190.125,2017-01-20 23:31:15,true +13,Tyne,Elner,telnerc@jiathis.com,165.155.112.184,2017-06-12 23:42:54,false +14,Lita,Kitley,lkitleyd@gmpg.org,138.131.8.94,2018-01-25 15:03:51,false +15,Alan,Morsley,amorsleye@dell.com,5.81.121.91,2016-03-18 19:37:49,true +16,Erinn,Stokoe,estokoef@walmart.com,244.57.254.248,2017-02-23 22:51:09,true +17,Dela,Oxley,doxleyg@state.gov,163.86.24.94,2017-04-12 20:19:20,true +18,Daryle,Reeve,dreeveh@1und1.de,175.30.172.20,2017-07-09 20:46:10,false +19,Micah,Smitham,msmithami@techcrunch.com,164.75.157.186,2016-02-25 16:17:57,true +20,Bernice,Van der Velde,bvanderveldej@i2i.jp,141.99.132.98,2017-07-28 23:31:24,false +21,Odo,Janacek,ojanacekk@redcross.org,50.195.72.49,2017-05-01 05:59:30,false +22,Lyndsey,Exter,lexterl@scribd.com,244.5.43.160,2017-02-13 11:32:04,false +23,Correy,Brash,cbrashm@loc.gov,233.67.52.95,2018-02-27 05:26:29,false +24,Lyle,Josilevich,ljosilevichn@rambler.ru,99.16.127.176,2016-08-06 03:37:03,false +25,Skip,Castiello,scastielloo@rambler.ru,118.174.3.50,2016-06-07 23:32:19,true +26,Philbert,Daltry,pdaltryp@tamu.edu,181.93.127.23,2016-08-16 12:52:52,true +27,Addie,Sikora,asikoraq@theatlantic.com,120.33.67.44,2016-09-01 12:45:37,true +28,Sibyl,Songist,ssongistr@noaa.gov,151.85.172.142,2016-02-11 01:14:50,false +29,Eyde,Dankersley,edankersleys@illinois.edu,147.170.154.132,2017-08-09 18:14:00,false +30,Dion,Pessler,dpesslert@reverbnation.com,51.92.202.203,2017-01-30 02:05:47,true +31,Rodd,Huntly,rhuntlyu@google.ru,82.198.158.0,2016-04-22 06:44:15,false +32,Inness,Cartmer,icartmerv@tripod.com,44.147.127.200,2017-03-11 12:03:56,false +33,Blakeley,Figgins,bfigginsw@ebay.co.uk,116.54.91.30,2016-05-28 14:25:49,true +34,Yancey,Leeburne,yleeburnex@people.com.cn,8.44.104.205,2016-08-09 03:15:02,false +35,Gustavus,Kemp,gkempy@sourceforge.net,101.126.34.176,2018-02-02 12:15:57,true +36,Annabela,Ardron,aardronz@slideshare.net,135.255.20.212,2017-10-29 03:13:03,true +37,Allister,Janota,ajanota10@yahoo.com,41.139.90.112,2016-09-19 04:21:50,true +38,Yoko,McBryde,ymcbryde11@weather.com,124.17.222.132,2016-08-21 14:32:04,false +39,Aprilette,Colebeck,acolebeck12@elegantthemes.com,14.62.14.45,2017-04-04 04:47:31,true +40,Oralia,Marklew,omarklew13@cnet.com,108.161.10.231,2017-12-29 23:15:15,true +41,Vi,Bryde,vbryde14@harvard.edu,20.91.132.215,2017-12-01 21:02:36,false +42,Koren,Emmanueli,kemmanueli15@fotki.com,151.86.146.63,2016-11-10 22:36:05,true +43,Corrie,Pendry,cpendry16@technorati.com,78.110.104.252,2017-11-22 07:57:23,true +44,Berton,Jakovijevic,bjakovijevic17@themeforest.net,243.201.191.244,2017-12-22 20:30:37,false +45,Ahmad,Lawerence,alawerence18@bluehost.com,234.146.69.92,2017-07-07 17:37:17,true +46,Walther,Mardee,wmardee19@sciencedirect.com,86.10.226.173,2016-06-23 09:20:51,false +47,Raynor,Reignolds,rreignolds1a@github.com,192.159.109.53,2016-04-19 13:32:00,false +48,Dom,Brodhead,dbrodhead1b@ed.gov,13.193.83.80,2016-09-24 03:16:43,false +49,Patton,Marrett,pmarrett1c@sourceforge.net,73.142.143.198,2016-06-02 19:20:48,true +50,Murielle,Reina,mreina1d@washington.edu,88.67.241.169,2017-10-01 01:56:52,true +51,Markos,Zylberdik,mzylberdik1e@ask.com,169.62.233.37,2017-03-23 19:40:19,true +52,Dorisa,Gosalvez,dgosalvez1f@mit.edu,10.111.156.111,2016-02-24 12:37:30,true +53,Amata,Moar,amoar1g@tinypic.com,214.241.229.183,2016-05-22 05:04:06,true +54,Graehme,Finnigan,gfinnigan1h@trellian.com,229.14.230.4,2016-12-27 00:49:18,true +55,Tanya,Sheers,tsheers1i@house.gov,43.212.37.134,2018-02-04 05:17:30,true +56,Germain,Beavers,gbeavers1j@hexun.com,91.219.240.74,2017-01-26 23:03:39,false +57,Emmye,Cerie,ecerie1k@independent.co.uk,58.183.233.79,2017-04-30 14:13:31,true +58,Reese,Glaisner,rglaisner1l@dropbox.com,63.181.9.68,2016-07-29 05:49:41,true +59,Christie,Phlippsen,cphlippsen1m@ucoz.ru,236.91.248.168,2017-07-07 12:37:10,false +60,Anthia,Tolland,atolland1n@hibu.com,124.60.13.101,2016-02-06 14:38:37,true +61,Annamarie,Pipworth,apipworth1o@ftc.gov,53.219.191.107,2017-06-13 08:29:04,true +62,Price,O'Gready,pogready1p@theatlantic.com,131.188.180.57,2016-09-28 08:44:38,false +63,Sergei,Cicero,scicero1q@telegraph.co.uk,100.97.16.84,2017-10-02 15:58:45,false +64,Dolorita,Lilion,dlilion1r@vimeo.com,150.43.252.51,2017-09-06 12:39:46,true +65,Perrine,Peetermann,ppeetermann1s@fema.gov,93.27.202.229,2017-07-08 08:49:37,false +66,Frieda,Gemelli,fgemelli1t@altervista.org,20.21.177.102,2016-04-18 05:58:59,false +67,Webster,Tully,wtully1u@nba.com,61.55.62.136,2016-02-18 11:01:23,true +68,Clara,Dadd,cdadd1v@rakuten.co.jp,67.84.203.36,2017-06-10 22:20:50,false +69,Gardener,Clarkin,gclarkin1w@bbc.co.uk,211.175.17.92,2017-11-27 23:33:42,true +70,Doll,Celez,dcelez1x@imdb.com,65.124.34.165,2017-01-03 06:40:44,true +71,Willy,Remnant,wremnant1y@nasa.gov,183.190.219.35,2017-05-27 11:05:47,false +72,Felicle,Scoterbosh,fscoterbosh1z@macromedia.com,12.103.23.230,2017-05-04 05:22:27,true +73,Egan,Ryland,eryland20@t.co,227.35.15.147,2016-06-09 11:50:39,true +74,Donny,Clissold,dclissold21@yellowpages.com,210.51.117.212,2016-03-08 22:48:18,true +75,Gwyneth,Brash,gbrash22@vistaprint.com,30.243.157.153,2016-01-23 17:11:17,true +76,Mervin,Woolis,mwoolis23@elegantthemes.com,52.171.162.135,2017-06-17 15:36:58,false +77,Alicea,Mewton,amewton24@com.com,236.53.172.152,2017-12-21 10:35:45,true +78,Whittaker,Biaggiotti,wbiaggiotti25@patch.com,85.219.77.207,2017-12-27 09:25:13,true +79,Teddie,Matevushev,tmatevushev26@nsw.gov.au,121.24.14.214,2017-12-09 16:30:35,false +80,Mal,Mc Gee,mmcgee27@eventbrite.com,85.138.92.81,2016-01-14 03:02:43,true +81,Teressa,Lourenco,tlourenco28@zdnet.com,33.2.78.199,2016-03-17 02:29:47,false +82,Willabella,Danelutti,wdanelutti29@ted.com,221.78.224.255,2016-03-06 14:34:53,true +83,Samaria,Hessle,shessle2a@surveymonkey.com,216.8.59.131,2017-03-30 11:02:45,true +84,Ruperto,Staite,rstaite2b@wikispaces.com,79.47.189.125,2017-08-23 22:09:19,true +85,Ashlee,Scotsbrook,ascotsbrook2c@trellian.com,91.104.127.195,2017-10-02 15:01:49,false +86,Godfry,Lawson,glawson2d@seesaa.net,241.54.44.84,2016-04-03 04:42:19,false +87,Rose,Lathleiffure,rlathleiffure2e@instagram.com,21.172.211.218,2016-05-11 04:37:44,true +88,Ricky,Helwig,rhelwig2f@sciencedirect.com,130.213.100.214,2017-12-02 11:58:19,true +89,Hersh,Castleman,hcastleman2g@mediafire.com,196.170.63.20,2016-11-06 15:18:34,false +90,Upton,Midghall,umidghall2h@wordpress.org,29.108.156.94,2017-03-24 03:48:22,true +91,Devi,Lowmass,dlowmass2i@parallels.com,243.189.157.74,2016-07-31 13:35:43,true +92,Cherry,Goldstein,cgoldstein2j@delicious.com,21.78.25.159,2016-06-02 22:19:13,true +93,Alfy,Yakubovics,ayakubovics2k@bigcartel.com,29.28.179.184,2016-10-13 08:03:28,true +94,Ambrosi,Martinyuk,amartinyuk2l@163.com,1.42.244.146,2016-01-24 23:02:40,false +95,Daniel,Duly,dduly2m@engadget.com,74.32.138.66,2017-03-26 09:02:19,false +96,Hazlett,Oakton,hoakton2n@booking.com,248.196.158.127,2016-11-01 10:55:45,true +97,Vivienne,Millery,vmillery2o@nyu.edu,99.21.99.255,2016-04-19 15:25:08,true +98,Glynda,Kupper,gkupper2p@yahoo.co.jp,89.13.224.249,2016-04-05 07:01:28,false +99,Pavlov,MacDwyer,pmacdwyer2q@netvibes.com,147.162.14.191,2018-02-10 06:57:45,true +100,Fonzie,Filip,ffilip2r@tripadvisor.com,244.178.118.180,2016-11-18 00:09:42,false diff --git a/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_km.csv b/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_km.csv new file mode 100644 index 0000000..636442f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_km.csv @@ -0,0 +1,2 @@ +lat_1,lon_1,lat_2,lon_2,output +48.864716,2.349014,52.379189,4.899431,430 diff --git a/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_mi.csv b/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_mi.csv new file mode 100644 index 0000000..cc4757f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/geo/data_haversine_mi.csv @@ -0,0 +1,2 @@ +lat_1,lon_1,lat_2,lon_2,output +48.864716,2.349014,52.379189,4.899431,267 diff --git a/dbt_packages/dbt_utils/integration_tests/data/materializations/data_insert_by_period.csv b/dbt_packages/dbt_utils/integration_tests/data/materializations/data_insert_by_period.csv new file mode 100644 index 0000000..2b5cccf --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/materializations/data_insert_by_period.csv @@ -0,0 +1,10 @@ +id,created_at +1,2017-12-02 +2,2018-01-02 +3,2018-02-02 +4,2018-03-02 +5,2018-04-02 +6,2018-05-02 +7,2018-06-02 +8,2018-07-02 +9,2018-08-02 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_a.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_a.csv new file mode 100644 index 0000000..ad9cdeb --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_a.csv @@ -0,0 +1,4 @@ +same_name +1 +2 +3 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_b.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_b.csv new file mode 100644 index 0000000..dfca57d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_cardinality_equality_b.csv @@ -0,0 +1,4 @@ +same_name,different_name +1,2 +2,3 +3,1 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_not_null_proportion.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_not_null_proportion.csv new file mode 100644 index 0000000..b28bb8a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_not_null_proportion.csv @@ -0,0 +1,11 @@ +point_5,point_9 +1,1 +,2 +,3 +4,4 +5,5 +6,6 +,7 +,8 +, +10,10 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_accepted_range.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_accepted_range.csv new file mode 100644 index 0000000..38b90a5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_accepted_range.csv @@ -0,0 +1,3 @@ +id +-1 +11 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_at_least_one.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_at_least_one.csv new file mode 100644 index 0000000..8b75a3f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_at_least_one.csv @@ -0,0 +1,2 @@ +field +a diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_equal_rowcount.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_equal_rowcount.csv new file mode 100644 index 0000000..25b5f50 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_equal_rowcount.csv @@ -0,0 +1,4 @@ +field +1 +1 +2 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_expression_is_true.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_expression_is_true.csv new file mode 100644 index 0000000..eeab2b7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_expression_is_true.csv @@ -0,0 +1,4 @@ +col_a,col_b +0,1 +1,0 +0.5,0.5 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_1.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_1.csv new file mode 100644 index 0000000..ba0e5ec --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_1.csv @@ -0,0 +1,4 @@ +field +1 +2 +3 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_2.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_2.csv new file mode 100644 index 0000000..eb0f035 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_fewer_rows_than_table_2.csv @@ -0,0 +1,5 @@ +field +1 +2 +3 +4 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_no_gaps.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_no_gaps.csv new file mode 100644 index 0000000..72dc14e --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_no_gaps.csv @@ -0,0 +1,4 @@ +lower_bound,upper_bound +0,1 +1,2 +2,4 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps.csv new file mode 100644 index 0000000..9b7adb0 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps.csv @@ -0,0 +1,5 @@ +subscription_id,valid_from,valid_to +1,2019-01-01,2019-02-01 +1,2019-03-03,2019-04-01 +2,2019-05-06,2019-07-02 +2,2019-07-03, diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps_zero_length.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps_zero_length.csv new file mode 100644 index 0000000..29330c8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_mutually_exclusive_ranges_with_gaps_zero_length.csv @@ -0,0 +1,7 @@ +subscription_id,valid_from,valid_to +3,2020-05-06,2020-05-07 +3,2020-05-08,2020-05-08 +3,2020-05-09,2020-05-10 +4,2020-06-06,2020-06-07 +4,2020-06-08,2020-06-08 +4,2020-06-09,2020-06-10 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_accepted_values.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_accepted_values.csv new file mode 100644 index 0000000..85b190f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_accepted_values.csv @@ -0,0 +1,5 @@ +id,city +1,Barcelona +2,London +3,Paris +4,New York diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_constant.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_constant.csv new file mode 100644 index 0000000..25b5f50 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_constant.csv @@ -0,0 +1,4 @@ +field +1 +1 +2 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_null_where.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_null_where.csv new file mode 100644 index 0000000..b7c914c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_not_null_where.csv @@ -0,0 +1,5 @@ +id,_deleted +1,false +2,false + ,true +3,false \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_1.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_1.csv new file mode 100644 index 0000000..7a8faf7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_1.csv @@ -0,0 +1,4 @@ +id +1 +2 +3 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_2.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_2.csv new file mode 100644 index 0000000..6090791 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_relationships_where_table_2.csv @@ -0,0 +1,4 @@ +id +1 +2 +4 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_timestamps.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_timestamps.csv new file mode 100644 index 0000000..e15c83c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_timestamps.csv @@ -0,0 +1,5 @@ +my_timestamp +2021-01-01 00:00 +2021-01-01 01:00 +2021-01-01 02:00 +2021-01-01 03:00 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_values.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_values.csv new file mode 100644 index 0000000..56bee2d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_sequential_values.csv @@ -0,0 +1,6 @@ +my_even_sequence +2 +4 +6 +8 +10 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_unique_where.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_unique_where.csv new file mode 100644 index 0000000..89e4ca8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_test_unique_where.csv @@ -0,0 +1,5 @@ +id,_deleted +1,false +2,false +2,true +3,true \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_unique_combination_of_columns.csv b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_unique_combination_of_columns.csv new file mode 100644 index 0000000..09d64b5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/data_unique_combination_of_columns.csv @@ -0,0 +1,7 @@ +month,product,revenue +2019-01-01,jaffle,500 +2019-01-01,lamington,100 +2019-01-01,pavlova,600 +2019-02-01,jaffle,300 +2019-02-01,lamington,300 +2019-02-01,pavlova,400 diff --git a/dbt_packages/dbt_utils/integration_tests/data/schema_tests/schema.yml b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/schema.yml new file mode 100644 index 0000000..72263d6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/schema_tests/schema.yml @@ -0,0 +1,18 @@ +version: 2 + +seeds: + - name: data_test_sequential_values + columns: + - name: my_even_sequence + tests: + - dbt_utils.sequential_values: + interval: 2 + + + - name: data_test_sequential_timestamps + columns: + - name: my_timestamp + tests: + - dbt_utils.sequential_values: + interval: 1 + datepart: 'hour' diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate.csv new file mode 100644 index 0000000..7e06170 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate.csv @@ -0,0 +1,4 @@ +user_id,event,version +1,play,1 +1,play,2 +2,pause,1 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate_expected.csv new file mode 100644 index 0000000..de5e204 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_deduplicate_expected.csv @@ -0,0 +1,2 @@ +user_id,event,version +1,play,2 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180101.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180101.csv new file mode 100644 index 0000000..5570828 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180101.csv @@ -0,0 +1,3 @@ +user_id,event +1,play +2,pause diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180102.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180102.csv new file mode 100644 index 0000000..aaa69a3 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180102.csv @@ -0,0 +1,3 @@ +user_id,event +3,play +4,pause diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180103.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180103.csv new file mode 100644 index 0000000..4379e0d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_events_20180103.csv @@ -0,0 +1,3 @@ +user_id,event +5,play +6,pause diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation.csv new file mode 100644 index 0000000..9d96143 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation.csv @@ -0,0 +1,4 @@ +field_1,field_2,field_3 +a,b,c +d,e,f +g,h,i \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation_expected.csv new file mode 100644 index 0000000..77ea056 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_filtered_columns_in_relation_expected.csv @@ -0,0 +1,2 @@ +field_2,field_3 +h,i \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_generate_series.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_generate_series.csv new file mode 100644 index 0000000..1964c4a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_generate_series.csv @@ -0,0 +1,11 @@ +generated_number +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values.csv new file mode 100644 index 0000000..5651149 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values.csv @@ -0,0 +1,12 @@ +field +a +b +c +d +e +f +g +g +g +g +g diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_dropped.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_dropped.csv new file mode 100644 index 0000000..5651149 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_dropped.csv @@ -0,0 +1,12 @@ +field +a +b +c +d +e +f +g +g +g +g +g diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where.csv new file mode 100644 index 0000000..0295f55 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where.csv @@ -0,0 +1,12 @@ +field,condition +a,left +b,right +c,left +d,right +e,left +f,right +g,left +g,right +g,left +g,right +g,left \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where_expected.csv new file mode 100644 index 0000000..e821706 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_column_values_where_expected.csv @@ -0,0 +1,5 @@ +field +a +c +e +g \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_query_results_as_dict.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_query_results_as_dict.csv new file mode 100644 index 0000000..c44b43b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_get_query_results_as_dict.csv @@ -0,0 +1,4 @@ +col_1,col_2,col_3 +1,a,True +2,b,False +3,c, diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_nullcheck_table.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_nullcheck_table.csv new file mode 100644 index 0000000..3b6cdd7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_nullcheck_table.csv @@ -0,0 +1,4 @@ +field_1,field_2,field_3 +a,'',1 +'',b,2 +'','',3 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot.csv new file mode 100644 index 0000000..4725599 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot.csv @@ -0,0 +1,5 @@ +size,color +S,red +S,blue +S,blue's +M,red \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected.csv new file mode 100644 index 0000000..a7702c7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected.csv @@ -0,0 +1,3 @@ +size,red,blue +S,1,1 +M,1,0 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected_apostrophe.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected_apostrophe.csv new file mode 100644 index 0000000..1f403a2 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_pivot_expected_apostrophe.csv @@ -0,0 +1,3 @@ +size,red,blue,blues +S,1,1,1 +M,1,0,0 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_add.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_add.csv new file mode 100644 index 0000000..26e314e --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_safe_add.csv @@ -0,0 +1,5 @@ +field_1,field_2,field_3,expected +1,2,3,6 +1,,3,4 +,,2,2 +,,,0 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_star.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star.csv new file mode 100644 index 0000000..7415076 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star.csv @@ -0,0 +1,4 @@ +field_1,field_2,field_3 +a,b,c +d,e,f +g,h,i diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate.csv new file mode 100644 index 0000000..19d4744 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate.csv @@ -0,0 +1,5 @@ +group_field_1,group_field_2,value_field +a,b,1 +a,b,2 +c,d,3 +c,e,4 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate_expected.csv new file mode 100644 index 0000000..d705638 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_aggregate_expected.csv @@ -0,0 +1,4 @@ +group_field_1,group_field_2,value_field_sum +a,b,3 +c,d,3 +c,e,4 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_expected.csv new file mode 100644 index 0000000..f5aa3ee --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_expected.csv @@ -0,0 +1,4 @@ +field_1,field_2 +a,b +d,e +g,h diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_prefix_suffix_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_prefix_suffix_expected.csv new file mode 100644 index 0000000..fd34199 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_star_prefix_suffix_expected.csv @@ -0,0 +1,4 @@ +prefix_field_1_suffix,prefix_field_2_suffix,prefix_field_3_suffix +a,b,c +d,e,f +g,h,i diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_surrogate_key.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_surrogate_key.csv new file mode 100644 index 0000000..bc2f4b0 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_surrogate_key.csv @@ -0,0 +1,5 @@ +column_1,column_2,column_3,expected_column_1_only,expected_all_columns +a,b,c,0cc175b9c0f1b6a831c399e269772661,7b193b3d33184464106f41ddf733783b +a,,c,0cc175b9c0f1b6a831c399e269772661,c5fd1b92380c6222ab0ef67839208624 +,,c,d41d8cd98f00b204e9800998ecf8427e,267743defab4558f1940311b66274e26 +,,,d41d8cd98f00b204e9800998ecf8427e,cfab1ba8c67c7c838db98d666f02a132 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_events_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_events_expected.csv new file mode 100644 index 0000000..86303b2 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_events_expected.csv @@ -0,0 +1,7 @@ +user_id,event +1,play +2,pause +3,play +4,pause +5,play +6,pause diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_expected.csv new file mode 100644 index 0000000..6c7d8f6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_expected.csv @@ -0,0 +1,6 @@ +id,name,favorite_color,favorite_number +1,"drew",,pi +2,"bob",,e +3,"alice",,4 +1,,"green",7 +2,,"pink",13 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_1.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_1.csv new file mode 100644 index 0000000..d8270ee --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_1.csv @@ -0,0 +1,4 @@ +id,name,favorite_number +1,drew,pi +2,bob,e +3,alice,4 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_2.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_2.csv new file mode 100644 index 0000000..1ce620b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_union_table_2.csv @@ -0,0 +1,3 @@ +id,favorite_color,favorite_number +1,green,7 +2,pink,13 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot.csv new file mode 100644 index 0000000..273ec56 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot.csv @@ -0,0 +1,4 @@ +customer_id,created_at,status,segment,name +123,2017-01-01,active,tier 1,name 1 +234,2017-02-01,active,tier 3,name 3 +567,2017-03-01,churned,tier 2,name 2 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool.csv new file mode 100644 index 0000000..5127779 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool.csv @@ -0,0 +1,4 @@ +customer_id,created_at,status,segment,is_updated +123,2017-01-01,active,tier 1,TRUE +234,2017-02-01,active,tier 3,FALSE +567,2017-03-01,churned,tier 2, diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool_expected.csv new file mode 100644 index 0000000..4e688a6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_bool_expected.csv @@ -0,0 +1,10 @@ +customer_id,created_at,prop,val +123,2017-01-01,segment,tier 1 +123,2017-01-01,status,active +123,2017-01-01,is_updated,true +234,2017-02-01,segment,tier 3 +234,2017-02-01,status,active +234,2017-02-01,is_updated,false +567,2017-03-01,status,churned +567,2017-03-01,is_updated, +567,2017-03-01,segment,tier 2 diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_expected.csv new file mode 100644 index 0000000..e2c92fb --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_expected.csv @@ -0,0 +1,7 @@ +customer_id,created_at,prop,val +123,"2017-01-01","segment","tier 1" +123,"2017-01-01","status","active" +234,"2017-02-01","segment","tier 3" +234,"2017-02-01","status","active" +567,"2017-03-01","status","churned" +567,"2017-03-01","segment","tier 2" diff --git a/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_original_api_expected.csv b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_original_api_expected.csv new file mode 100644 index 0000000..a2add2c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/sql/data_unpivot_original_api_expected.csv @@ -0,0 +1,10 @@ +customer_id,created_at,field_name,value +123,2017-01-01,status,active +123,2017-01-01,segment,tier 1 +234,2017-02-01,status,active +234,2017-02-01,segment,tier 3 +567,2017-03-01,status,churned +567,2017-03-01,segment,tier 2 +123,2017-01-01,name,name 1 +234,2017-02-01,name,name 3 +567,2017-03-01,name,name 2 \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/web/data_url_host.csv b/dbt_packages/dbt_utils/integration_tests/data/web/data_url_host.csv new file mode 100644 index 0000000..2350bb7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/web/data_url_host.csv @@ -0,0 +1,7 @@ +original_url,parsed_url +www.google.co.uk?utm_source=google&utm_medium=cpc&utm_campaign=spring-summer,www.google.co.uk +http://witanddelight.com/2018/01/tips-tricks-how-run-half-marathon-first-time/,witanddelight.com +https://www.nytimes.com/2018/01/01/blog,www.nytimes.com +android-app://m.facebook.com/,m.facebook.com +docs.nytimes.com/2021/01/01/index.js?utm_source=google,docs.nytimes.com +https://m.facebook.com/,m.facebook.com \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/web/data_url_path.csv b/dbt_packages/dbt_utils/integration_tests/data/web/data_url_path.csv new file mode 100644 index 0000000..e21d8dd --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/web/data_url_path.csv @@ -0,0 +1,5 @@ +original_url,parsed_path +www.google.co.uk?utm_source=google&utm_medium=cpc&utm_campaign=spring-summer, +http://witanddelight.com/2018/01/tips-tricks-how-run-half-marathon-first-time/,2018/01/tips-tricks-how-run-half-marathon-first-time/ +https://www.nytimes.com/2018/01/01/blog,2018/01/01/blog +http://witanddelight.com/2018/01/tips-tricks-how-run-half-marathon-first-time/?utm_source=google&utm_medium=cpc&utm_campaign=spring-summer,2018/01/tips-tricks-how-run-half-marathon-first-time/ \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/data/web/data_urls.csv b/dbt_packages/dbt_utils/integration_tests/data/web/data_urls.csv new file mode 100644 index 0000000..a98bd19 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/data/web/data_urls.csv @@ -0,0 +1,3 @@ +url,medium,source +http://drewbanin.com/milky?utm_medium=organic,organic, +http://drewbanin.com/milky?utm_medium=organic&utm_source=github,organic,github diff --git a/dbt_packages/dbt_utils/integration_tests/dbt_project.yml b/dbt_packages/dbt_utils/integration_tests/dbt_project.yml new file mode 100644 index 0000000..b442112 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/dbt_project.yml @@ -0,0 +1,66 @@ + +name: 'dbt_utils_integration_tests' +version: '1.0' + +profile: 'integration_tests' + +# require-dbt-version: inherit this from dbt-utils + +config-version: 2 + +model-paths: ["models"] +analysis-paths: ["analysis"] +test-paths: ["tests"] +seed-paths: ["data"] +macro-paths: ["macros"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_modules" + - "dbt_packages" + +dispatch: + - macro_namespace: 'dbt_utils' + search_order: ['dbt_utils_integration_tests', 'dbt_utils'] + +seeds: + + +quote_columns: false + dbt_utils_integration_tests: + + cross_db: + data_date_trunc: + +column_types: + updated_at: timestamp + day: date + month: date + + data_dateadd: + +column_types: + from_time: timestamp + result: timestamp + + data_datediff: + +column_types: + first_date: timestamp + second_date: timestamp + + data_width_bucket: + +column_types: + num_buckets: integer + min_value: float + max_value: float + + sql: + data_events_20180103: + +schema: events + + data_get_column_values_dropped: + # this.incorporate() to hardcode the node's type as otherwise dbt doesn't know it yet + +post-hook: "{% do adapter.drop_relation(this.incorporate(type='table')) %}" + + schema_tests: + data_test_sequential_timestamps: + +column_types: + my_timestamp: timestamp diff --git a/dbt_packages/dbt_utils/integration_tests/macros/.gitkeep b/dbt_packages/dbt_utils/integration_tests/macros/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_utils/integration_tests/macros/assert_equal_values.sql b/dbt_packages/dbt_utils/integration_tests/macros/assert_equal_values.sql new file mode 100644 index 0000000..d4f0261 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/macros/assert_equal_values.sql @@ -0,0 +1,32 @@ +{% macro assert_equal_values(actual_object, expected_object) %} +{% if not execute %} + + {# pass #} + +{% elif actual_object != expected_object %} + + {% set msg %} + Expected did not match actual + + ----------- + Actual: + ----------- + --->{{ actual_object }}<--- + + ----------- + Expected: + ----------- + --->{{ expected_object }}<--- + + {% endset %} + + {{ log(msg, info=True) }} + + select 'fail' + +{% else %} + + select 'ok' {{ limit_zero() }} + +{% endif %} +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/macros/limit_zero.sql b/dbt_packages/dbt_utils/integration_tests/macros/limit_zero.sql new file mode 100644 index 0000000..697849d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/macros/limit_zero.sql @@ -0,0 +1,11 @@ +{% macro my_custom_macro() %} + whatever +{% endmacro %} + +{% macro limit_zero() %} + {{ return(adapter.dispatch('limit_zero', 'dbt_utils')()) }} +{% endmacro %} + +{% macro default__limit_zero() %} + {{ return('limit 0') }} +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/macros/tests.sql b/dbt_packages/dbt_utils/integration_tests/macros/tests.sql new file mode 100644 index 0000000..046fab3 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/macros/tests.sql @@ -0,0 +1,12 @@ + +{% test assert_equal(model, actual, expected) %} +select * from {{ model }} where {{ actual }} != {{ expected }} + +{% endtest %} + + +{% test not_empty_string(model, column_name) %} + +select * from {{ model }} where {{ column_name }} = '' + +{% endtest %} diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/schema.yml new file mode 100644 index 0000000..c33b0b5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/schema.yml @@ -0,0 +1,120 @@ +version: 2 + +models: + - name: test_any_value + tests: + - dbt_utils.equality: + compare_model: ref('data_any_value_expected') + + - name: test_array_append + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_array_concat + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_array_construct + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_bool_or + tests: + - dbt_utils.equality: + compare_model: ref('data_bool_or_expected') + + - name: test_concat + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_current_timestamp + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_date_trunc + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_dateadd + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_datediff + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_hash + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_last_day + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_length + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_listagg + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_safe_cast + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_split_part + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_replace + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_right + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_position + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_width_bucket + tests: + - assert_equal: + actual: actual + expected: expected \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_any_value.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_any_value.sql new file mode 100644 index 0000000..9b27ed1 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_any_value.sql @@ -0,0 +1,19 @@ +with some_model as ( + select 1 as id, 'abc' as key_name, 'dbt' as static_col union all + select 2 as id, 'abc' as key_name, 'dbt' as static_col union all + select 3 as id, 'jkl' as key_name, 'dbt' as static_col union all + select 4 as id, 'jkl' as key_name, 'dbt' as static_col union all + select 5 as id, 'jkl' as key_name, 'dbt' as static_col union all + select 6 as id, 'xyz' as key_name, 'test' as static_col +), + +final as ( + select + key_name, + {{ dbt_utils.any_value('static_col') }} as static_col, + count(id) as num_rows + from some_model + group by key_name +) + +select * from final \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_append.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_append.sql new file mode 100644 index 0000000..12193a6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_append.sql @@ -0,0 +1,29 @@ +with data as ( + + select + data_array_append.element, + data_array_append.result_as_string, + data_array_construct.num_input_1, + data_array_construct.num_input_2, + data_array_construct.num_input_3 + from {{ ref('data_array_append') }} as data_array_append + left join {{ ref('data_array_construct') }} as data_array_construct + on data_array_append.array_as_string = data_array_construct.result_as_string + +), + +appended_array as ( + + select + {{ dbt_utils.array_append(dbt_utils.array_construct(['num_input_1', 'num_input_2', 'num_input_3']), 'element') }} as array_actual, + result_as_string as expected + from data + +) + +-- we need to cast the arrays to strings in order to compare them to the output in our seed file +select + array_actual, + {{ dbt_utils.cast_array_to_string('array_actual') }} as actual, + expected +from appended_array \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_concat.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_concat.sql new file mode 100644 index 0000000..907a9df --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_concat.sql @@ -0,0 +1,36 @@ +with data as ( + + select + data_array_concat.result_as_string, + array_1.num_input_1 as array_1_num_input_1, + array_1.num_input_2 as array_1_num_input_2, + array_1.num_input_3 as array_1_num_input_3, + array_2.num_input_1 as array_2_num_input_1, + array_2.num_input_2 as array_2_num_input_2, + array_2.num_input_3 as array_2_num_input_3 + from {{ ref('data_array_concat') }} as data_array_concat + left join {{ ref('data_array_construct') }} as array_1 + on data_array_concat.array_1_as_string = array_1.result_as_string + left join {{ ref('data_array_construct') }} as array_2 + on data_array_concat.array_2_as_string = array_2.result_as_string + +), + +concat_array as ( + + select + {{ dbt_utils.array_concat( + dbt_utils.array_construct(['array_1_num_input_1', 'array_1_num_input_2', 'array_1_num_input_3']), + dbt_utils.array_construct(['array_2_num_input_1', 'array_2_num_input_2', 'array_2_num_input_3']) + ) }} as array_actual, + result_as_string as expected + from data + +) + +-- we need to cast the arrays to strings in order to compare them to the output in our seed file +select + array_actual, + {{ dbt_utils.cast_array_to_string('array_actual') }} as actual, + expected +from concat_array \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_construct.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_construct.sql new file mode 100644 index 0000000..52dbf4b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_array_construct.sql @@ -0,0 +1,27 @@ +with data as ( + + select * from {{ ref('data_array_construct') }} + +), + +array_construct as ( + select + {{ dbt_utils.array_construct(['num_input_1', 'num_input_2', 'num_input_3']) }} as array_actual, + result_as_string as expected + + from data + + union all + + select + {{ dbt_utils.array_construct() }} as array_actual, + '[]' as expected + +) + +-- we need to cast the arrays to strings in order to compare them to the output in our seed file +select + array_actual, + {{ dbt_utils.cast_array_to_string('array_actual') }} as actual, + expected +from array_construct \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_bool_or.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_bool_or.sql new file mode 100644 index 0000000..7375d1e --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_bool_or.sql @@ -0,0 +1,5 @@ +select + key, + {{ dbt_utils.bool_or('val1 = val2') }} as value +from {{ ref('data_bool_or' )}} +group by key \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_concat.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_concat.sql new file mode 100644 index 0000000..9efeb74 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_concat.sql @@ -0,0 +1,12 @@ + +with data as ( + + select * from {{ ref('data_concat') }} + +) + +select + {{ dbt_utils.concat(['input_1', 'input_2']) }} as actual, + output as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp.sql new file mode 100644 index 0000000..9a777f2 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp.sql @@ -0,0 +1,6 @@ + +-- how can we test this better? +select + {{ dbt_utils.current_timestamp() }} as actual, + {{ dbt_utils.current_timestamp() }} as expected + diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp_in_utc.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp_in_utc.sql new file mode 100644 index 0000000..55bc8e2 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_current_timestamp_in_utc.sql @@ -0,0 +1,5 @@ + +-- how can we test this better? +select + {{ dbt_utils.current_timestamp_in_utc() }} as actual, + {{ dbt_utils.current_timestamp_in_utc() }} as expected \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_date_trunc.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_date_trunc.sql new file mode 100644 index 0000000..bac21fe --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_date_trunc.sql @@ -0,0 +1,20 @@ + +with data as ( + + select * from {{ ref('data_date_trunc') }} + +) + +select + cast({{dbt_utils.date_trunc('day', 'updated_at') }} as date) as actual, + day as expected + +from data + +union all + +select + cast({{ dbt_utils.date_trunc('month', 'updated_at') }} as date) as actual, + month as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_dateadd.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_dateadd.sql new file mode 100644 index 0000000..3e199d8 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_dateadd.sql @@ -0,0 +1,18 @@ + +with data as ( + + select * from {{ ref('data_dateadd') }} + +) + +select + case + when datepart = 'hour' then cast({{ dbt_utils.dateadd('hour', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'day' then cast({{ dbt_utils.dateadd('day', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'month' then cast({{ dbt_utils.dateadd('month', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'year' then cast({{ dbt_utils.dateadd('year', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + else null + end as actual, + result as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_datediff.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_datediff.sql new file mode 100644 index 0000000..a234045 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_datediff.sql @@ -0,0 +1,35 @@ + +with data as ( + + select * from {{ ref('data_datediff') }} + +) + +select + + case + when datepart = 'second' then {{ dbt_utils.datediff('first_date', 'second_date', 'second') }} + when datepart = 'minute' then {{ dbt_utils.datediff('first_date', 'second_date', 'minute') }} + when datepart = 'hour' then {{ dbt_utils.datediff('first_date', 'second_date', 'hour') }} + when datepart = 'day' then {{ dbt_utils.datediff('first_date', 'second_date', 'day') }} + when datepart = 'week' then {{ dbt_utils.datediff('first_date', 'second_date', 'week') }} + when datepart = 'month' then {{ dbt_utils.datediff('first_date', 'second_date', 'month') }} + when datepart = 'year' then {{ dbt_utils.datediff('first_date', 'second_date', 'year') }} + else null + end as actual, + result as expected + +from data + +-- Also test correct casting of literal values. + +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "microsecond") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "millisecond") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "second") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "minute") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "hour") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "day") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-03 00:00:00.000000'", "week") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "month") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "quarter") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "year") }} as actual, 1 as expected diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_hash.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_hash.sql new file mode 100644 index 0000000..8f01778 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_hash.sql @@ -0,0 +1,12 @@ + +with data as ( + + select * from {{ ref('data_hash') }} + +) + +select + {{ dbt_utils.hash('input_1') }} as actual, + output as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_last_day.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_last_day.sql new file mode 100644 index 0000000..fee3a82 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_last_day.sql @@ -0,0 +1,17 @@ + +with data as ( + + select * from {{ ref('data_last_day') }} + +) + +select + case + when date_part = 'month' then {{ dbt_utils.last_day('date_day', 'month') }} + when date_part = 'quarter' then {{ dbt_utils.last_day('date_day', 'quarter') }} + when date_part = 'year' then {{ dbt_utils.last_day('date_day', 'year') }} + else null + end as actual, + result as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_length.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_length.sql new file mode 100644 index 0000000..f4ef099 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_length.sql @@ -0,0 +1,12 @@ +with data as ( + + select * from {{ ref('data_length') }} + +) + +select + + {{ dbt_utils.length('expression') }} as actual, + output as expected + +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_listagg.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_listagg.sql new file mode 100644 index 0000000..006948d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_listagg.sql @@ -0,0 +1,69 @@ +with data as ( + + select * from {{ ref('data_listagg') }} + +), + +data_output as ( + + select * from {{ ref('data_listagg_output') }} + +), + +calculate as ( + + select + group_col, + {{ dbt_utils.listagg('string_text', "'_|_'", "order by order_col") }} as actual, + 'bottom_ordered' as version + from data + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text', "'_|_'", "order by order_col", 2) }} as actual, + 'bottom_ordered_limited' as version + from data + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text', "', '") }} as actual, + 'comma_whitespace_unordered' as version + from data + where group_col = 3 + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('DISTINCT string_text', "','") }} as actual, + 'distinct_comma' as version + from data + where group_col = 3 + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text') }} as actual, + 'no_params' as version + from data + where group_col = 3 + group by group_col + +) + +select + calculate.actual, + data_output.expected +from calculate +left join data_output +on calculate.group_col = data_output.group_col +and calculate.version = data_output.version \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_position.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_position.sql new file mode 100644 index 0000000..b09be66 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_position.sql @@ -0,0 +1,12 @@ +with data as ( + + select * from {{ ref('data_position') }} + +) + +select + + {{ dbt_utils.position('substring_text', 'string_text') }} as actual, + result as expected + +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_replace.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_replace.sql new file mode 100644 index 0000000..6c8a8aa --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_replace.sql @@ -0,0 +1,18 @@ +with data as ( + + select + + *, + coalesce(search_chars, '') as old_chars, + coalesce(replace_chars, '') as new_chars + + from {{ ref('data_replace') }} + +) + +select + + {{ dbt_utils.replace('string_text', 'old_chars', 'new_chars') }} as actual, + result as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_right.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_right.sql new file mode 100644 index 0000000..eaad4f4 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_right.sql @@ -0,0 +1,12 @@ +with data as ( + + select * from {{ ref('data_right') }} + +) + +select + + {{ dbt_utils.right('string_text', 'length_expression') }} as actual, + coalesce(output, '') as expected + +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_safe_cast.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_safe_cast.sql new file mode 100644 index 0000000..8ed74fc --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_safe_cast.sql @@ -0,0 +1,12 @@ + +with data as ( + + select * from {{ ref('data_safe_cast') }} + +) + +select + {{ dbt_utils.safe_cast('field', dbt_utils.type_string()) }} as actual, + output as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_split_part.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_split_part.sql new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_split_part.sql @@ -0,0 +1,36 @@ + +with data as ( + + select * from {{ ref('data_split_part') }} + +) + +select + {{ dbt_utils.split_part('parts', 'split_on', 1) }} as actual, + result_1 as expected + +from data + +union all + +select + {{ dbt_utils.split_part('parts', 'split_on', 2) }} as actual, + result_2 as expected + +from data + +union all + +select + {{ dbt_utils.split_part('parts', 'split_on', 3) }} as actual, + result_3 as expected + +from data + +union all + +select + {{ dbt_utils.split_part('parts', 'split_on', -1) }} as actual, + result_3 as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_width_bucket.sql b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_width_bucket.sql new file mode 100644 index 0000000..dc2b860 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/cross_db_utils/test_width_bucket.sql @@ -0,0 +1,12 @@ + +with data as ( + + select * from {{ ref('data_width_bucket') }} + +) + +select + {{ dbt_utils.width_bucket('amount', 'min_value', 'max_value', 'num_buckets') }} as actual, + bucket as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/datetime/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/datetime/schema.yml new file mode 100644 index 0000000..dbc3431 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/datetime/schema.yml @@ -0,0 +1,7 @@ +version: 2 + +models: + - name: test_date_spine + tests: + - dbt_utils.equality: + compare_model: ref('data_date_spine') diff --git a/dbt_packages/dbt_utils/integration_tests/models/datetime/test_date_spine.sql b/dbt_packages/dbt_utils/integration_tests/models/datetime/test_date_spine.sql new file mode 100644 index 0000000..fa4ae52 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/datetime/test_date_spine.sql @@ -0,0 +1,26 @@ + +-- snowflake doesn't like this as a view because the `generate_series` +-- call creates a CTE called `unioned`, as does the `equality` generic test. +-- Ideally, Snowflake would be smart enough to know that these CTE names are +-- different, as they live in different relations. TODO: use a less common cte name + +{{ config(materialized='table') }} + +with date_spine as ( + + {% if target.type == 'postgres' %} + {{ dbt_utils.date_spine("day", "'2018-01-01'::date", "'2018-01-10'::date") }} + + {% elif target.type == 'bigquery' %} + select cast(date_day as date) as date_day + from ({{ dbt_utils.date_spine("day", "'2018-01-01'", "'2018-01-10'") }}) + + {% else %} + {{ dbt_utils.date_spine("day", "'2018-01-01'", "'2018-01-10'") }} + {% endif %} + +) + +select date_day +from date_spine + diff --git a/dbt_packages/dbt_utils/integration_tests/models/generic_tests/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/schema.yml new file mode 100644 index 0000000..d5ea9d0 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/schema.yml @@ -0,0 +1,170 @@ +version: 2 + +seeds: + - name: data_test_not_constant + columns: + - name: field + tests: + - dbt_utils.not_constant + + - name: data_test_at_least_one + columns: + - name: field + tests: + - dbt_utils.at_least_one + + - name: data_test_expression_is_true + tests: + - dbt_utils.expression_is_true: + expression: col_a + col_b = 1 + - dbt_utils.expression_is_true: + expression: col_a = 0.5 + condition: col_b = 0.5 + columns: + - name: col_a + tests: + - dbt_utils.expression_is_true: + expression: + col_b = 1 + - name: col_b + tests: + - dbt_utils.expression_is_true: + expression: = 0.5 + condition: col_a = 0.5 + + - name: data_people + columns: + - name: is_active + tests: + - dbt_utils.cardinality_equality: + field: is_active + to: ref('data_people') + + - name: data_test_unique_where + columns: + - name: id + tests: + - dbt_utils.unique_where: + where: "_deleted = false" + + - name: data_test_not_null_where + columns: + - name: id + tests: + - dbt_utils.not_null_where: + where: "_deleted = false" + + - name: data_test_not_accepted_values + columns: + - name: city + tests: + - dbt_utils.not_accepted_values: + values: ['Madrid', 'Berlin'] + + - name: data_test_relationships_where_table_2 + columns: + - name: id + tests: + - dbt_utils.relationships_where: + to: ref('data_test_relationships_where_table_1') + field: id + from_condition: id <> 4 + + - name: data_test_mutually_exclusive_ranges_no_gaps + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: lower_bound + upper_bound_column: upper_bound + gaps: not_allowed + + - name: data_test_mutually_exclusive_ranges_with_gaps + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: valid_from + upper_bound_column: coalesce(valid_to, '2099-01-01') + partition_by: subscription_id + gaps: allowed + + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: valid_from + upper_bound_column: coalesce(valid_to, '2099-01-01') + partition_by: subscription_id + gaps: required + + - name: data_test_mutually_exclusive_ranges_with_gaps_zero_length + tests: + - dbt_utils.mutually_exclusive_ranges: + lower_bound_column: valid_from + upper_bound_column: valid_to + partition_by: subscription_id + zero_length_range_allowed: true + + - name: data_unique_combination_of_columns + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - month + - product + + - name: data_cardinality_equality_a + columns: + - name: same_name + tests: + - dbt_utils.cardinality_equality: + to: ref('data_cardinality_equality_b') + field: same_name + - dbt_utils.cardinality_equality: + to: ref('data_cardinality_equality_b') + field: different_name + + - name: data_test_accepted_range + columns: + - name: id + tests: + - dbt_utils.accepted_range: + min_value: -1 + max_value: 11 + inclusive: true + + - dbt_utils.accepted_range: + min_value: -2 + max_value: 11.1 + inclusive: false + + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + where: "id <> -1" + + - name: data_not_null_proportion + columns: + - name: point_5 + tests: + - dbt_utils.not_null_proportion: + at_least: 0.5 + at_most: 0.5 + - name: point_9 + tests: + - dbt_utils.not_null_proportion: + at_least: 0.9 + +models: + - name: test_recency + tests: + - dbt_utils.recency: + datepart: day + field: today + interval: 1 + + - name: test_equal_rowcount + tests: + - dbt_utils.equal_rowcount: + compare_model: ref('test_equal_rowcount') + + - name: test_equal_column_subset + tests: + - dbt_utils.equality: + compare_model: ref('data_people') + compare_columns: + - first_name + - last_name + - email diff --git a/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_column_subset.sql b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_column_subset.sql new file mode 100644 index 0000000..b426bb6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_column_subset.sql @@ -0,0 +1,9 @@ +{{ config(materialized='ephemeral') }} + +select + + first_name, + last_name, + email + +from {{ ref('data_people') }} diff --git a/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_rowcount.sql b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_rowcount.sql new file mode 100644 index 0000000..01b1a54 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_equal_rowcount.sql @@ -0,0 +1,9 @@ +with data as ( + + select * from {{ ref('data_test_equal_rowcount') }} + +) + +select + field +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_fewer_rows_than.sql b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_fewer_rows_than.sql new file mode 100644 index 0000000..c2ad4cb --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_fewer_rows_than.sql @@ -0,0 +1,9 @@ +with data as ( + + select * from {{ ref('data_test_fewer_rows_than_table_1') }} + +) + +select + field +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_recency.sql b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_recency.sql new file mode 100644 index 0000000..d300e57 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/generic_tests/test_recency.sql @@ -0,0 +1,12 @@ + +{% if target.type == 'postgres' %} + +select + {{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as today + +{% else %} + +select + cast({{ dbt_utils.date_trunc('day', dbt_utils.current_timestamp()) }} as datetime) as today + +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/models/geo/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/geo/schema.yml new file mode 100644 index 0000000..50dd024 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/geo/schema.yml @@ -0,0 +1,13 @@ +version: 2 + +models: + - name: test_haversine_distance_km + tests: + - assert_equal: + actual: actual + expected: expected + - name: test_haversine_distance_mi + tests: + - assert_equal: + actual: actual + expected: expected diff --git a/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_km.sql b/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_km.sql new file mode 100644 index 0000000..e8ca481 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_km.sql @@ -0,0 +1,23 @@ +with data as ( + select * from {{ ref('data_haversine_km') }} +), +final as ( + select + output as expected, + cast( + {{ + dbt_utils.haversine_distance( + lat1='lat_1', + lon1='lon_1', + lat2='lat_2', + lon2='lon_2', + unit='km' + ) + }} as {{ dbt_utils.type_numeric() }} + ) as actual + from data +) +select + expected, + round(actual,0) as actual +from final diff --git a/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_mi.sql b/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_mi.sql new file mode 100644 index 0000000..53f8172 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/geo/test_haversine_distance_mi.sql @@ -0,0 +1,39 @@ +with data as ( + select * from {{ ref('data_haversine_mi') }} +), +final as ( + select + output as expected, + cast( + {{ + dbt_utils.haversine_distance( + lat1='lat_1', + lon1='lon_1', + lat2='lat_2', + lon2='lon_2', + unit='mi' + ) + }} as {{ dbt_utils.type_numeric() }} + ) as actual + from data + + union all + + select + output as expected, + cast( + {{ + dbt_utils.haversine_distance( + lat1='lat_1', + lon1='lon_1', + lat2='lat_2', + lon2='lon_2', + ) + }} as {{ dbt_utils.type_numeric() }} + ) as actual + from data +) +select + expected, + round(actual,0) as actual +from final diff --git a/dbt_packages/dbt_utils/integration_tests/models/materializations/expected_insert_by_period.sql b/dbt_packages/dbt_utils/integration_tests/models/materializations/expected_insert_by_period.sql new file mode 100644 index 0000000..0a198b6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/materializations/expected_insert_by_period.sql @@ -0,0 +1,10 @@ +{{ + config( + materialized = 'view', + enabled=(target.type == 'redshift') + ) +}} + +select * +from {{ ref('data_insert_by_period') }} +where id in (2, 3, 4, 5, 6) diff --git a/dbt_packages/dbt_utils/integration_tests/models/materializations/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/materializations/schema.yml new file mode 100644 index 0000000..d33ad15 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/materializations/schema.yml @@ -0,0 +1,7 @@ +version: 2 + +models: + - name: test_insert_by_period + tests: + - dbt_utils.equality: + compare_model: ref('expected_insert_by_period') diff --git a/dbt_packages/dbt_utils/integration_tests/models/materializations/test_insert_by_period.sql b/dbt_packages/dbt_utils/integration_tests/models/materializations/test_insert_by_period.sql new file mode 100644 index 0000000..8cc396d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/materializations/test_insert_by_period.sql @@ -0,0 +1,18 @@ +{{ + config( + materialized = 'insert_by_period', + period = 'month', + timestamp_field = 'created_at', + start_date = '2018-01-01', + stop_date = '2018-06-01', + enabled=(target.type == 'redshift') + ) +}} + +with events as ( + select * + from {{ ref('data_insert_by_period') }} + where __PERIOD_FILTER__ +) + +select * from events diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/sql/schema.yml new file mode 100644 index 0000000..a74b5d6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/schema.yml @@ -0,0 +1,179 @@ +version: 2 + +models: + - name: test_generate_series + tests: + - dbt_utils.equality: + compare_model: ref('data_generate_series') + + - name: test_get_column_values + columns: + - name: count_a + tests: + - accepted_values: + values: + - '1' + + - name: count_b + tests: + - accepted_values: + values: + - '1' + + - name: count_c + tests: + - accepted_values: + values: + - '1' + + - name: count_d + tests: + - accepted_values: + values: + - '1' + + - name: count_e + tests: + - accepted_values: + values: + - '1' + + - name: count_f + tests: + - accepted_values: + values: + - '1' + + - name: count_g + tests: + - accepted_values: + values: + - '5' + + - name: test_get_column_values_where + tests: + - dbt_utils.equality: + compare_model: ref('data_get_column_values_where_expected') + + - name: test_get_filtered_columns_in_relation + tests: + - dbt_utils.equality: + compare_model: ref('data_filtered_columns_in_relation_expected') + + - name: test_get_relations_by_prefix_and_union + columns: + - name: event + tests: + - not_null + - name: user_id + tests: + - dbt_utils.at_least_one + - not_null + - unique + + - name: test_nullcheck_table + columns: + - name: field_1 + tests: + - not_empty_string + + - name: field_2 + tests: + - not_empty_string + + - name: field_3 + tests: + - not_empty_string + + - name: test_safe_add + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_pivot + tests: + - dbt_utils.equality: + compare_model: ref('data_pivot_expected') + + - name: test_pivot_apostrophe + tests: + - dbt_utils.equality: + compare_model: ref('data_pivot_expected_apostrophe') + + - name: test_unpivot_original_api + tests: + - dbt_utils.equality: + compare_model: ref('data_unpivot_original_api_expected') + + - name: test_unpivot + tests: + - dbt_utils.equality: + compare_model: ref('data_unpivot_expected') + + - name: test_unpivot_bool + tests: + - dbt_utils.equality: + compare_model: ref('data_unpivot_bool_expected') + + - name: test_star + tests: + - dbt_utils.equality: + compare_model: ref('data_star_expected') + + - name: test_star_prefix_suffix + tests: + - dbt_utils.equality: + compare_model: ref('data_star_prefix_suffix_expected') + + - name: test_star_aggregate + tests: + - dbt_utils.equality: + compare_model: ref('data_star_aggregate_expected') + + - name: test_star_uppercase + tests: + - dbt_utils.equality: + compare_model: ref('data_star_expected') + + - name: test_surrogate_key + tests: + - assert_equal: + actual: actual_column_1_only + expected: expected_column_1_only + - assert_equal: + actual: actual_all_columns_arguments + expected: expected_all_columns + - assert_equal: + actual: actual_all_columns_list + expected: expected_all_columns + + - name: test_union + tests: + - dbt_utils.equality: + compare_model: ref('data_union_expected') + + - name: test_union_where + columns: + - name: id + tests: + - dbt_utils.expression_is_true: + expression: "= 1" + - name: favorite_number + tests: + - dbt_utils.not_constant + + - name: test_get_relations_by_pattern + tests: + - dbt_utils.equality: + compare_model: ref('data_union_events_expected') + + - name: test_deduplicate + tests: + - dbt_utils.equality: + compare_model: ref('data_deduplicate_expected') + + - name: test_deduplicate_deprecated + tests: + - dbt_utils.equality: + compare_model: ref('data_deduplicate_expected') diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate.sql new file mode 100644 index 0000000..226555b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate.sql @@ -0,0 +1,21 @@ +with + +source as ( + select * + from {{ ref('data_deduplicate') }} + where user_id = 1 +), + +deduped as ( + + {{ + dbt_utils.deduplicate( + 'source', + partition_by='user_id', + order_by='version desc', + ) | indent + }} + +) + +select * from deduped diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate_deprecated.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate_deprecated.sql new file mode 100644 index 0000000..b80db2c --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_deduplicate_deprecated.sql @@ -0,0 +1,22 @@ +with + +source as ( + select * + from {{ ref('data_deduplicate') }} + where user_id = 1 +), + +deduped as ( + + {{ + dbt_utils.deduplicate( + ref('data_deduplicate'), + group_by='user_id', + order_by='version desc', + relation_alias='source', + ) | indent + }} + +) + +select * from deduped diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_generate_series.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_generate_series.sql new file mode 100644 index 0000000..11370b7 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_generate_series.sql @@ -0,0 +1,15 @@ + +-- snowflake doesn't like this as a view because the `generate_series` +-- call creates a CTE called `unioned`, as does the `equality` generic test. +-- Ideally, Snowflake would be smart enough to know that these CTE names are +-- different, as they live in different relations. TODO: use a less common cte name + +{{ config(materialized='table') }} + +with data as ( + + {{ dbt_utils.generate_series(10) }} + +) + +select generated_number from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values.sql new file mode 100644 index 0000000..3621498 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values.sql @@ -0,0 +1,29 @@ + +{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values'), 'field', default=[], order_by="field") %} + + +{% if target.type == 'snowflake' %} + +select + {% for val in column_values -%} + + sum(case when field = '{{ val }}' then 1 else 0 end) as count_{{ val }} + {%- if not loop.last %},{% endif -%} + + {%- endfor %} + +from {{ ref('data_get_column_values') }} + +{% else %} + +select + {% for val in column_values -%} + + {{dbt_utils.safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", dbt_utils.type_string()) }} as count_{{ val }} + {%- if not loop.last %},{% endif -%} + + {%- endfor %} + +from {{ ref('data_get_column_values') }} + +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values_where.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values_where.sql new file mode 100644 index 0000000..a85a23a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_column_values_where.sql @@ -0,0 +1,6 @@ +{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_where'), 'field', where="condition = 'left'") %} + +-- Create a relation using the values +{% for val in column_values -%} +select {{ dbt_utils.string_literal(val) }} as field {% if not loop.last %}union all{% endif %} +{% endfor %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_filtered_columns_in_relation.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_filtered_columns_in_relation.sql new file mode 100644 index 0000000..7b3ca72 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_filtered_columns_in_relation.sql @@ -0,0 +1,16 @@ +{% set exclude_field = 'field_1' %} +{% set column_names = dbt_utils.get_filtered_columns_in_relation(from= ref('data_filtered_columns_in_relation'), except=[exclude_field]) %} + +with data as ( + + select + + {% for column_name in column_names %} + max({{ column_name }}) as {{ column_name }} {% if not loop.last %},{% endif %} + {% endfor %} + + from {{ ref('data_filtered_columns_in_relation') }} + +) + +select * from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_pattern.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_pattern.sql new file mode 100644 index 0000000..52ab07a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_pattern.sql @@ -0,0 +1,16 @@ +{{ config(materialized = 'table') }} + +{% set relations = dbt_utils.get_relations_by_pattern(target.schema ~ '%', 'data_events_%') %} + +with unioned as ( + + {{ dbt_utils.union_relations(relations) }} + +) + +select + + user_id, + event + +from unioned diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_prefix_and_union.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_prefix_and_union.sql new file mode 100644 index 0000000..481f233 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_get_relations_by_prefix_and_union.sql @@ -0,0 +1,4 @@ +{{ config(materialized = 'table') }} + +{% set relations = dbt_utils.get_relations_by_prefix(target.schema, 'data_events_') %} +{{ dbt_utils.union_relations(relations) }} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_groupby.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_groupby.sql new file mode 100644 index 0000000..50a6ced --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_groupby.sql @@ -0,0 +1,24 @@ +with test_data as ( + + select + + {{ dbt_utils.safe_cast("'a'", dbt_utils.type_string() )}} as column_1, + {{ dbt_utils.safe_cast("'b'", dbt_utils.type_string() )}} as column_2 + +), + +grouped as ( + + select + *, + count(*) as total + + from test_data + {{ dbt_utils.group_by(2) }} + +) + +select * from grouped + + + diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_nullcheck_table.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_nullcheck_table.sql new file mode 100644 index 0000000..ea66c8e --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_nullcheck_table.sql @@ -0,0 +1,41 @@ +{{ config( materialized = "table" ) }} + +-- TO DO: remove if-statement + +{% set tbl = ref('data_nullcheck_table') %} + + +with nulled as ( + + {{ dbt_utils.nullcheck_table(tbl) }} + +) + +{% if target.type == 'snowflake' %} + +select + field_1::varchar as field_1, + field_2::varchar as field_2, + field_3::varchar as field_3 + +from nulled + +{% else %} + +select + + {{ dbt_utils.safe_cast('field_1', + dbt_utils.type_string() + )}} as field_1, + + {{ dbt_utils.safe_cast('field_2', + dbt_utils.type_string() + )}} as field_2, + + {{ dbt_utils.safe_cast('field_3', + dbt_utils.type_string() + )}} as field_3 + +from nulled + +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot.sql new file mode 100644 index 0000000..a63e6e3 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot.sql @@ -0,0 +1,17 @@ + +-- TODO: How do we make this work nicely on Snowflake too? + +{% if target.type == 'snowflake' %} + {% set column_values = ['RED', 'BLUE'] %} + {% set cmp = 'ilike' %} +{% else %} + {% set column_values = ['red', 'blue'] %} + {% set cmp = '=' %} +{% endif %} + +select + size, + {{ dbt_utils.pivot('color', column_values, cmp=cmp) }} + +from {{ ref('data_pivot') }} +group by size diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot_apostrophe.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot_apostrophe.sql new file mode 100644 index 0000000..792f468 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_pivot_apostrophe.sql @@ -0,0 +1,17 @@ + +-- TODO: How do we make this work nicely on Snowflake too? + +{% if target.type == 'snowflake' %} + {% set column_values = ['RED', 'BLUE', "BLUE'S"] %} + {% set cmp = 'ilike' %} +{% else %} + {% set column_values = ['red', 'blue', "blue's"] %} + {% set cmp = '=' %} +{% endif %} + +select + size, + {{ dbt_utils.pivot('color', column_values, cmp=cmp, quote_identifiers=False) }} + +from {{ ref('data_pivot') }} +group by size diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_add.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_add.sql new file mode 100644 index 0000000..af3894d --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_safe_add.sql @@ -0,0 +1,12 @@ + +with data as ( + + select * from {{ ref('data_safe_add') }} + +) + +select + {{ dbt_utils.safe_add('field_1', 'field_2', 'field_3') }} as actual, + expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_star.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star.sql new file mode 100644 index 0000000..2092e16 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star.sql @@ -0,0 +1,13 @@ +{% set exclude_field = 'field_3' %} + + +with data as ( + + select + {{ dbt_utils.star(from=ref('data_star'), except=[exclude_field]) }} + + from {{ ref('data_star') }} + +) + +select * from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_aggregate.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_aggregate.sql new file mode 100644 index 0000000..9dcd7c2 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_aggregate.sql @@ -0,0 +1,16 @@ +/*This test checks that column aliases aren't applied unless there's a prefix/suffix necessary, to ensure that GROUP BYs keep working*/ + +{% set selected_columns = dbt_utils.star(from=ref('data_star_aggregate'), except=['value_field']) %} + +with data as ( + + select + {{ selected_columns }}, + sum(value_field) as value_field_sum + + from {{ ref('data_star_aggregate') }} + group by {{ selected_columns }} + +) + +select * from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_prefix_suffix.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_prefix_suffix.sql new file mode 100644 index 0000000..ae1c64f --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_prefix_suffix.sql @@ -0,0 +1,13 @@ +{% set prefix_with = 'prefix_' if target.type != 'snowflake' else 'PREFIX_' %} +{% set suffix_with = '_suffix' if target.type != 'snowflake' else '_SUFFIX' %} + +with data as ( + + select + {{ dbt_utils.star(from=ref('data_star'), prefix=prefix_with, suffix=suffix_with) }} + + from {{ ref('data_star') }} + +) + +select * from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_uppercase.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_uppercase.sql new file mode 100644 index 0000000..6179e69 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_star_uppercase.sql @@ -0,0 +1,13 @@ +{% set exclude_field = 'FIELD_3' %} + + +with data as ( + + select + {{ dbt_utils.star(from=ref('data_star'), except=[exclude_field]) }} + + from {{ ref('data_star') }} + +) + +select * from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_surrogate_key.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_surrogate_key.sql new file mode 100644 index 0000000..fd90939 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_surrogate_key.sql @@ -0,0 +1,15 @@ + +with data as ( + + select * from {{ ref('data_surrogate_key') }} + +) + +select + {{ dbt_utils.surrogate_key('column_1') }} as actual_column_1_only, + expected_column_1_only, + {{ dbt_utils.surrogate_key('column_1', 'column_2', 'column_3') }} as actual_all_columns_arguments, + {{ dbt_utils.surrogate_key(['column_1', 'column_2', 'column_3']) }} as actual_all_columns_list, + expected_all_columns + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_union.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union.sql new file mode 100644 index 0000000..6983683 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union.sql @@ -0,0 +1,8 @@ + +select + id, + name, + favorite_color + +from {{ ref('test_union_base') }} + diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_base.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_base.sql new file mode 100644 index 0000000..a51bd2b --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_base.sql @@ -0,0 +1,5 @@ + +{{ dbt_utils.union_relations([ + ref('data_union_table_1'), + ref('data_union_table_2')] +) }} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where.sql new file mode 100644 index 0000000..a5986d4 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where.sql @@ -0,0 +1,5 @@ +select + id, + favorite_number +from + {{ ref('test_union_where_base') }} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where_base.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where_base.sql new file mode 100644 index 0000000..177db51 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_union_where_base.sql @@ -0,0 +1,4 @@ +{{ dbt_utils.union_relations( + [ref('data_union_table_1'), ref('data_union_table_2')], + where="id = 1" +) }} diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot.sql new file mode 100644 index 0000000..8cf1ad6 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot.sql @@ -0,0 +1,33 @@ + +-- snowflake messes with these tests pretty badly since the +-- output of the macro considers the casing of the source +-- table columns. Using some hacks here to get this to work, +-- but we should consider lowercasing the unpivot macro output +-- at some point in the future for consistency + +{% if target.name == 'snowflake' %} + {% set exclude = ['CUSTOMER_ID', 'CREATED_AT'] %} +{% else %} + {% set exclude = ['customer_id', 'created_at'] %} +{% endif %} + + +select + customer_id, + created_at, + case + when '{{ target.name }}' = 'snowflake' then lower(prop) + else prop + end as prop, + val + +from ( + {{ dbt_utils.unpivot( + relation=ref('data_unpivot'), + cast_to=dbt_utils.type_string(), + exclude=exclude, + remove=['name'], + field_name='prop', + value_name='val' + ) }} +) as sbq diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_bool.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_bool.sql new file mode 100644 index 0000000..26842c0 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_bool.sql @@ -0,0 +1,32 @@ + +-- snowflake messes with these tests pretty badly since the +-- output of the macro considers the casing of the source +-- table columns. Using some hacks here to get this to work, +-- but we should consider lowercasing the unpivot macro output +-- at some point in the future for consistency + +{% if target.name == 'snowflake' %} + {% set exclude = ['CUSTOMER_ID', 'CREATED_AT'] %} +{% else %} + {% set exclude = ['customer_id', 'created_at'] %} +{% endif %} + + +select + customer_id, + created_at, + case + when '{{ target.name }}' = 'snowflake' then lower(prop) + else prop + end as prop, + val + +from ( + {{ dbt_utils.unpivot( + relation=ref('data_unpivot_bool'), + cast_to=dbt_utils.type_string(), + exclude=exclude, + field_name='prop', + value_name='val' + ) }} +) as sbq diff --git a/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_original_api.sql b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_original_api.sql new file mode 100644 index 0000000..f6b9395 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/sql/test_unpivot_original_api.sql @@ -0,0 +1,32 @@ + +-- unpivot() was enhanced with 3 new parameters +-- This test targets the original API. + +-- snowflake messes with these tests pretty badly since the +-- output of the macro considers the casing of the source +-- table columns. Using some hacks here to get this to work, +-- but we should consider lowercasing the unpivot macro output +-- at some point in the future for consistency + +{% if target.name == 'snowflake' %} + {% set exclude = ['CUSTOMER_ID', 'CREATED_AT'] %} +{% else %} + {% set exclude = ['customer_id', 'created_at'] %} +{% endif %} + +select + customer_id, + created_at, + case + when '{{ target.name }}' = 'snowflake' then lower(FIELD_NAME) + else field_name + end as field_name, + value + +from ( + {{ dbt_utils.unpivot( + table=ref('data_unpivot'), + cast_to=dbt_utils.type_string(), + exclude=exclude + ) }} +) as sbq diff --git a/dbt_packages/dbt_utils/integration_tests/models/web/schema.yml b/dbt_packages/dbt_utils/integration_tests/models/web/schema.yml new file mode 100644 index 0000000..53776bd --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/web/schema.yml @@ -0,0 +1,20 @@ +version: 2 + +models: + - name: test_urls + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_url_host + tests: + - assert_equal: + actual: actual + expected: expected + + - name: test_url_path + tests: + - assert_equal: + actual: actual + expected: expected \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/web/test_url_host.sql b/dbt_packages/dbt_utils/integration_tests/models/web/test_url_host.sql new file mode 100644 index 0000000..06a9f69 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/web/test_url_host.sql @@ -0,0 +1,12 @@ +with data as ( + + select * from {{ref('data_url_host')}} + +) + +select + + {{ dbt_utils.get_url_host('original_url') }} as actual, + parsed_url as expected + +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/web/test_url_path.sql b/dbt_packages/dbt_utils/integration_tests/models/web/test_url_path.sql new file mode 100644 index 0000000..c03e554 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/web/test_url_path.sql @@ -0,0 +1,12 @@ +with data as ( + + select * from {{ref('data_url_path')}} + +) + +select + + coalesce({{ dbt_utils.get_url_path('original_url') }}, '') as actual, + coalesce(parsed_path, '') as expected + +from data \ No newline at end of file diff --git a/dbt_packages/dbt_utils/integration_tests/models/web/test_urls.sql b/dbt_packages/dbt_utils/integration_tests/models/web/test_urls.sql new file mode 100644 index 0000000..60353db --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/models/web/test_urls.sql @@ -0,0 +1,20 @@ + +with data as ( + + select * from {{ ref('data_urls') }} + +) + +select + {{ dbt_utils.get_url_parameter('url', 'utm_medium') }} as actual, + medium as expected + +from data + +union all + +select + {{ dbt_utils.get_url_parameter('url', 'utm_source') }} as actual, + source as expected + +from data diff --git a/dbt_packages/dbt_utils/integration_tests/packages.yml b/dbt_packages/dbt_utils/integration_tests/packages.yml new file mode 100644 index 0000000..7468ac5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/packages.yml @@ -0,0 +1,3 @@ + +packages: + - local: ../ diff --git a/dbt_packages/dbt_utils/integration_tests/tests/assert_get_query_results_as_dict_objects_equal.sql b/dbt_packages/dbt_utils/integration_tests/tests/assert_get_query_results_as_dict_objects_equal.sql new file mode 100644 index 0000000..55d5400 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/tests/assert_get_query_results_as_dict_objects_equal.sql @@ -0,0 +1,81 @@ +-- depends_on: {{ ref('data_get_query_results_as_dict') }} + +{% set expected_dictionary={ + 'col_1': [1, 2, 3], + 'col_2': ['a', 'b', 'c'], + 'col_3': [True, False, none] +} %} + +{#- Handle snowflake casing silliness -#} +{% if target.type == 'snowflake' %} +{% set expected_dictionary={ + 'COL_1': [1, 2, 3], + 'COL_2': ['a', 'b', 'c'], + 'COL_3': [True, False, none] +} %} +{% endif %} + + +{% set actual_dictionary=dbt_utils.get_query_results_as_dict( + "select * from " ~ ref('data_get_query_results_as_dict') ~ " order by 1" +) %} +{#- +For reasons that remain unclear, Jinja won't return True for actual_dictionary == expected_dictionary. +Instead, we'll manually check that the values of these dictionaries are equivalent. +-#} + +{% set ns = namespace( + pass=True, + err_msg = "" +) %} +{% if execute %} +{#- Check that the dictionaries have the same keys -#} +{% set expected_keys=expected_dictionary.keys() | list | sort %} +{% set actual_keys=actual_dictionary.keys() | list | sort %} + +{% if expected_keys != actual_keys %} + {% set ns.pass=False %} + {% set ns.err_msg %} + The two dictionaries have different keys: + expected_dictionary has keys: {{ expected_keys }} + actual_dictionary has keys: {{ actual_keys }} + {% endset %} + +{% else %} + +{% for key, value in expected_dictionary.items() %} + {% set expected_length=expected_dictionary[key] | length %} + {% set actual_length=actual_dictionary[key] | length %} + + {% if expected_length != actual_length %} + {% set ns.pass=False %} + {% set ns.err_msg %} + The {{ key }} column has different lengths: + expected_dictionary[{{ key }}] has length {{ expected_length }} + actual_dictionary[{{ key }}] has length {{ actual_length }} + {% endset %} + + {% else %} + + {% for i in range(value | length) %} + {% set expected_value=expected_dictionary[key][i] %} + {% set actual_value=actual_dictionary[key][i] %} + {% if expected_value != actual_value %} + {% set ns.pass=False %} + {% set ns.err_msg %} + The {{ key }} column has differing values: + expected_dictionary[{{ key }}][{{ i }}] == {{ expected_value }} + actual_dictionary[{{ key }}][{{ i }}] == {{ actual_value }} + {% endset %} + + {% endif %} + {% endfor %} + {% endif %} + +{% endfor %} + +{% endif %} + +{{ log(ns.err_msg, info=True) }} +select 1 as col_name {% if ns.pass %} {{ limit_zero() }} {% endif %} +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_output_msg_is_string.sql b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_output_msg_is_string.sql new file mode 100644 index 0000000..fea3359 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_output_msg_is_string.sql @@ -0,0 +1,7 @@ +{% if dbt_utils.pretty_log_format() is string %} + {# Return 0 rows for the test to pass #} + select 1 as col_name {{ limit_zero() }} +{% else %} + {# Return >0 rows for the test to fail #} + select 1 +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_time_is_string.sql b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_time_is_string.sql new file mode 100644 index 0000000..a6347ab --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/assert_pretty_time_is_string.sql @@ -0,0 +1,7 @@ +{% if dbt_utils.pretty_time() is string %} + {# Return 0 rows for the test to pass #} + select 1 as col_name {{ limit_zero() }} +{% else %} + {# Return >0 rows for the test to fail #} + select 1 +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/test_slugify.sql b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/test_slugify.sql new file mode 100644 index 0000000..c0839f5 --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/tests/jinja_helpers/test_slugify.sql @@ -0,0 +1,7 @@ +{% if dbt_utils.slugify('!Hell0 world-hi') == 'hell0_world_hi' %} + {# Return 0 rows for the test to pass #} + select 1 as col_name {{ limit_zero() }} +{% else %} + {# Return >0 rows for the test to fail #} + select 1 as col_name +{% endif %} diff --git a/dbt_packages/dbt_utils/integration_tests/tests/sql/test_get_column_values_use_default.sql b/dbt_packages/dbt_utils/integration_tests/tests/sql/test_get_column_values_use_default.sql new file mode 100644 index 0000000..7f9fa3a --- /dev/null +++ b/dbt_packages/dbt_utils/integration_tests/tests/sql/test_get_column_values_use_default.sql @@ -0,0 +1,26 @@ + +{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_dropped'), 'field', default=['y', 'z'], order_by="field") %} + +with expected as ( + select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected_column_value union all + select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected_column_value +), + +actual as ( + + {% for val in column_values %} + select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual_column_value + {% if not loop.last %} + union all + {% endif %} + {% endfor %} +), + +failures as ( + select * from actual + where actual.actual_column_value not in ( + select expected.expected_column_value from expected + ) +) + +select * from failures \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/_is_ephemeral.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/_is_ephemeral.sql new file mode 100644 index 0000000..34c70db --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/_is_ephemeral.sql @@ -0,0 +1,16 @@ +{% macro _is_ephemeral(obj, macro) %} + {%- if obj.is_cte -%} + {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %} + {% if obj.name.startswith(ephemeral_prefix) %} + {% set model_name = obj.name[(ephemeral_prefix|length):] %} + {% else %} + {% set model_name = obj.name %} + {%- endif -%} + {% set error_message %} +The `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema. + +`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead. + {% endset %} + {%- do exceptions.raise_compiler_error(error_message) -%} + {%- endif -%} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/_is_relation.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/_is_relation.sql new file mode 100644 index 0000000..bee6db9 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/_is_relation.sql @@ -0,0 +1,5 @@ +{% macro _is_relation(obj, macro) %} + {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%} + {%- do exceptions.raise_compiler_error("Macro " ~ macro ~ " expected a Relation but received the value: " ~ obj) -%} + {%- endif -%} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/any_value.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/any_value.sql new file mode 100644 index 0000000..78cb75b --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/any_value.sql @@ -0,0 +1,17 @@ +{% macro any_value(expression) -%} + {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }} +{% endmacro %} + + +{% macro default__any_value(expression) -%} + + any_value({{ expression }}) + +{%- endmacro %} + + +{% macro postgres__any_value(expression) -%} + {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#} + min({{ expression }}) + +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/array_append.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/array_append.sql new file mode 100644 index 0000000..0479108 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/array_append.sql @@ -0,0 +1,16 @@ +{% macro array_append(array, new_element) -%} + {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }} +{%- endmacro %} + +{# new_element must be the same data type as elements in array to match postgres functionality #} +{% macro default__array_append(array, new_element) -%} + array_append({{ array }}, {{ new_element }}) +{%- endmacro %} + +{% macro bigquery__array_append(array, new_element) -%} + {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }} +{%- endmacro %} + +{% macro redshift__array_append(array, new_element) -%} + {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }} +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/array_concat.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/array_concat.sql new file mode 100644 index 0000000..1b7983c --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/array_concat.sql @@ -0,0 +1,15 @@ +{% macro array_concat(array_1, array_2) -%} + {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }} +{%- endmacro %} + +{% macro default__array_concat(array_1, array_2) -%} + array_cat({{ array_1 }}, {{ array_2 }}) +{%- endmacro %} + +{% macro bigquery__array_concat(array_1, array_2) -%} + array_concat({{ array_1 }}, {{ array_2 }}) +{%- endmacro %} + +{% macro redshift__array_concat(array_1, array_2) -%} + array_concat({{ array_1 }}, {{ array_2 }}) +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/array_construct.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/array_construct.sql new file mode 100644 index 0000000..63c6fe3 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/array_construct.sql @@ -0,0 +1,24 @@ +{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%} + {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }} +{%- endmacro %} + +{# all inputs must be the same data type to match postgres functionality #} +{% macro default__array_construct(inputs, data_type) -%} + {% if inputs|length > 0 %} + array[ {{ inputs|join(' , ') }} ] + {% else %} + array[]::{{data_type}}[] + {% endif %} +{%- endmacro %} + +{% macro snowflake__array_construct(inputs, data_type) -%} + array_construct( {{ inputs|join(' , ') }} ) +{%- endmacro %} + +{% macro redshift__array_construct(inputs, data_type) -%} + array( {{ inputs|join(' , ') }} ) +{%- endmacro %} + +{% macro bigquery__array_construct(inputs, data_type) -%} + [ {{ inputs|join(' , ') }} ] +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/bool_or.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/bool_or.sql new file mode 100644 index 0000000..ce0a685 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/bool_or.sql @@ -0,0 +1,24 @@ +{% macro bool_or(expression) -%} + {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }} +{% endmacro %} + + +{% macro default__bool_or(expression) -%} + + bool_or({{ expression }}) + +{%- endmacro %} + + +{% macro snowflake__bool_or(expression) -%} + + boolor_agg({{ expression }}) + +{%- endmacro %} + + +{% macro bigquery__bool_or(expression) -%} + + logical_or({{ expression }}) + +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/cast_array_to_string.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/cast_array_to_string.sql new file mode 100644 index 0000000..c88d6ef --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/cast_array_to_string.sql @@ -0,0 +1,22 @@ +{% macro cast_array_to_string(array) %} + {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }} +{% endmacro %} + +{% macro default__cast_array_to_string(array) %} + cast({{ array }} as {{ dbt_utils.type_string() }}) +{% endmacro %} + +{# when casting as array to string, postgres uses {} (ex: {1,2,3}) while other dbs use [] (ex: [1,2,3]) #} +{% macro postgres__cast_array_to_string(array) %} + {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%} + {{ dbt_utils.replace(dbt_utils.replace(array_as_string,"'}'","']'"),"'{'","'['") }} +{% endmacro %} + +{# redshift should use default instead of postgres #} +{% macro redshift__cast_array_to_string(array) %} + cast({{ array }} as {{ dbt_utils.type_string() }}) +{% endmacro %} + +{% macro bigquery__cast_array_to_string(array) %} + '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']' +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/cast_bool_to_text.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/cast_bool_to_text.sql new file mode 100644 index 0000000..5efa9d6 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/cast_bool_to_text.sql @@ -0,0 +1,15 @@ +{% macro cast_bool_to_text(field) %} + {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }} +{% endmacro %} + + +{% macro default__cast_bool_to_text(field) %} + cast({{ field }} as {{ dbt_utils.type_string() }}) +{% endmacro %} + +{% macro redshift__cast_bool_to_text(field) %} + case + when {{ field }} is true then 'true' + when {{ field }} is false then 'false' + end::text +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/concat.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/concat.sql new file mode 100644 index 0000000..7e97e8f --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/concat.sql @@ -0,0 +1,9 @@ + + +{% macro concat(fields) -%} + {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }} +{%- endmacro %} + +{% macro default__concat(fields) -%} + {{ fields|join(' || ') }} +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/current_timestamp.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/current_timestamp.sql new file mode 100644 index 0000000..66ad8dc --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/current_timestamp.sql @@ -0,0 +1,38 @@ +{% macro current_timestamp() -%} + {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }} +{%- endmacro %} + +{% macro default__current_timestamp() %} + current_timestamp::{{dbt_utils.type_timestamp()}} +{% endmacro %} + +{% macro redshift__current_timestamp() %} + getdate() +{% endmacro %} + +{% macro bigquery__current_timestamp() %} + current_timestamp +{% endmacro %} + + + +{% macro current_timestamp_in_utc() -%} + {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }} +{%- endmacro %} + +{% macro default__current_timestamp_in_utc() %} + {{dbt_utils.current_timestamp()}} +{% endmacro %} + +{% macro snowflake__current_timestamp_in_utc() %} + convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}} +{% endmacro %} + +{% macro postgres__current_timestamp_in_utc() %} + (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}} +{% endmacro %} + +{# redshift should use default instead of postgres #} +{% macro redshift__current_timestamp_in_utc() %} + {{ return(dbt_utils.default__current_timestamp_in_utc()) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/datatypes.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/datatypes.sql new file mode 100644 index 0000000..f115b4e --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/datatypes.sql @@ -0,0 +1,99 @@ +{# string ------------------------------------------------- #} + +{%- macro type_string() -%} + {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_string() %} + string +{% endmacro %} + +{%- macro redshift__type_string() -%} + varchar +{%- endmacro -%} + +{% macro postgres__type_string() %} + varchar +{% endmacro %} + +{% macro snowflake__type_string() %} + varchar +{% endmacro %} + + + +{# timestamp ------------------------------------------------- #} + +{%- macro type_timestamp() -%} + {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_timestamp() %} + timestamp +{% endmacro %} + +{% macro postgres__type_timestamp() %} + timestamp without time zone +{% endmacro %} + +{% macro snowflake__type_timestamp() %} + timestamp_ntz +{% endmacro %} + + +{# float ------------------------------------------------- #} + +{%- macro type_float() -%} + {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_float() %} + float +{% endmacro %} + +{% macro bigquery__type_float() %} + float64 +{% endmacro %} + +{# numeric ------------------------------------------------ #} + +{%- macro type_numeric() -%} + {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_numeric() %} + numeric(28, 6) +{% endmacro %} + +{% macro bigquery__type_numeric() %} + numeric +{% endmacro %} + + +{# bigint ------------------------------------------------- #} + +{%- macro type_bigint() -%} + {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_bigint() %} + bigint +{% endmacro %} + +{% macro bigquery__type_bigint() %} + int64 +{% endmacro %} + +{# int ------------------------------------------------- #} + +{%- macro type_int() -%} + {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__type_int() %} + int +{% endmacro %} + +{% macro bigquery__type_int() %} + int64 +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/date_trunc.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/date_trunc.sql new file mode 100644 index 0000000..f9d0364 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/date_trunc.sql @@ -0,0 +1,15 @@ +{% macro date_trunc(datepart, date) -%} + {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }} +{%- endmacro %} + +{% macro default__date_trunc(datepart, date) -%} + date_trunc('{{datepart}}', {{date}}) +{%- endmacro %} + +{% macro bigquery__date_trunc(datepart, date) -%} + timestamp_trunc( + cast({{date}} as timestamp), + {{datepart}} + ) + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/dateadd.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/dateadd.sql new file mode 100644 index 0000000..09c0f11 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/dateadd.sql @@ -0,0 +1,37 @@ +{% macro dateadd(datepart, interval, from_date_or_timestamp) %} + {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }} +{% endmacro %} + + +{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %} + + dateadd( + {{ datepart }}, + {{ interval }}, + {{ from_date_or_timestamp }} + ) + +{% endmacro %} + + +{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %} + + datetime_add( + cast( {{ from_date_or_timestamp }} as datetime), + interval {{ interval }} {{ datepart }} + ) + +{% endmacro %} + +{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %} + + {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }})) + +{% endmacro %} + +{# redshift should use default instead of postgres #} +{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %} + + {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/datediff.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/datediff.sql new file mode 100644 index 0000000..2b5d661 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/datediff.sql @@ -0,0 +1,66 @@ +{% macro datediff(first_date, second_date, datepart) %} + {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }} +{% endmacro %} + + +{% macro default__datediff(first_date, second_date, datepart) -%} + + datediff( + {{ datepart }}, + {{ first_date }}, + {{ second_date }} + ) + +{%- endmacro %} + + +{% macro bigquery__datediff(first_date, second_date, datepart) -%} + + datetime_diff( + cast({{second_date}} as datetime), + cast({{first_date}} as datetime), + {{datepart}} + ) + +{%- endmacro %} + +{% macro postgres__datediff(first_date, second_date, datepart) -%} + + {% if datepart == 'year' %} + (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date)) + {% elif datepart == 'quarter' %} + ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date)) + {% elif datepart == 'month' %} + ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date)) + {% elif datepart == 'day' %} + (({{second_date}})::date - ({{first_date}})::date) + {% elif datepart == 'week' %} + ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case + when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then + case when {{first_date}} <= {{second_date}} then 0 else -1 end + else + case when {{first_date}} <= {{second_date}} then 1 else 0 end + end) + {% elif datepart == 'hour' %} + ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp)) + {% elif datepart == 'minute' %} + ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp)) + {% elif datepart == 'second' %} + ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp))) + {% elif datepart == 'millisecond' %} + ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp))) + {% elif datepart == 'microsecond' %} + ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp))) + {% else %} + {{ exceptions.raise_compiler_error("Unsupported datepart for macro datediff in postgres: {!r}".format(datepart)) }} + {% endif %} + +{%- endmacro %} + + +{# redshift should use default instead of postgres #} +{% macro redshift__datediff(first_date, second_date, datepart) -%} + + {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }} + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/escape_single_quotes.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/escape_single_quotes.sql new file mode 100644 index 0000000..d024f16 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/escape_single_quotes.sql @@ -0,0 +1,18 @@ +{% macro escape_single_quotes(expression) %} + {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }} +{% endmacro %} + +{# /*Default to replacing a single apostrophe with two apostrophes: they're -> they''re*/ #} +{% macro default__escape_single_quotes(expression) -%} +{{ expression | replace("'","''") }} +{%- endmacro %} + +{# /*Snowflake uses a single backslash: they're -> they\'re. The second backslash is to escape it from Jinja */ #} +{% macro snowflake__escape_single_quotes(expression) -%} +{{ expression | replace("'", "\\'") }} +{%- endmacro %} + +{# /*BigQuery uses a single backslash: they're -> they\'re. The second backslash is to escape it from Jinja */ #} +{% macro bigquery__escape_single_quotes(expression) -%} +{{ expression | replace("'", "\\'") }} +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/except.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/except.sql new file mode 100644 index 0000000..9bb75b8 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/except.sql @@ -0,0 +1,16 @@ +{% macro except() %} + {{ return(adapter.dispatch('except', 'dbt_utils')()) }} +{% endmacro %} + + +{% macro default__except() %} + + except + +{% endmacro %} + +{% macro bigquery__except() %} + + except distinct + +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/hash.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/hash.sql new file mode 100644 index 0000000..d086c2e --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/hash.sql @@ -0,0 +1,13 @@ +{% macro hash(field) -%} + {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }} +{%- endmacro %} + + +{% macro default__hash(field) -%} + md5(cast({{field}} as {{dbt_utils.type_string()}})) +{%- endmacro %} + + +{% macro bigquery__hash(field) -%} + to_hex({{dbt_utils.default__hash(field)}}) +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/identifier.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/identifier.sql new file mode 100644 index 0000000..619cb7c --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/identifier.sql @@ -0,0 +1,16 @@ +{% macro identifier(value) %} + {%- set error_message = ' + Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \ + Use `adapter.quote` instead. The {}.{} model triggered this warning. \ + '.format(model.package_name, model.name) -%} + {%- do exceptions.warn(error_message) -%} + {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }} +{% endmacro %} + +{% macro default__identifier(value) -%} + "{{ value }}" +{%- endmacro %} + +{% macro bigquery__identifier(value) -%} + `{{ value }}` +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/intersect.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/intersect.sql new file mode 100644 index 0000000..b53c72f --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/intersect.sql @@ -0,0 +1,16 @@ +{% macro intersect() %} + {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }} +{% endmacro %} + + +{% macro default__intersect() %} + + intersect + +{% endmacro %} + +{% macro bigquery__intersect() %} + + intersect distinct + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/last_day.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/last_day.sql new file mode 100644 index 0000000..18ca161 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/last_day.sql @@ -0,0 +1,45 @@ +/* +This function has been tested with dateparts of month and quarters. Further +testing is required to validate that it will work on other dateparts. +*/ + +{% macro last_day(date, datepart) %} + {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }} +{% endmacro %} + + +{%- macro default_last_day(date, datepart) -%} + cast( + {{dbt_utils.dateadd('day', '-1', + dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date)) + )}} + as date) +{%- endmacro -%} + + +{% macro default__last_day(date, datepart) -%} + {{dbt_utils.default_last_day(date, datepart)}} +{%- endmacro %} + + +{% macro postgres__last_day(date, datepart) -%} + + {%- if datepart == 'quarter' -%} + -- postgres dateadd does not support quarter interval. + cast( + {{dbt_utils.dateadd('day', '-1', + dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date)) + )}} + as date) + {%- else -%} + {{dbt_utils.default_last_day(date, datepart)}} + {%- endif -%} + +{%- endmacro %} + +{# redshift should use default instead of postgres #} +{% macro redshift__last_day(date, datepart) %} + + {{ return(dbt_utils.default__last_day(date, datepart)) }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/length.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/length.sql new file mode 100644 index 0000000..8c2e265 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/length.sql @@ -0,0 +1,21 @@ +{% macro length(expression) -%} + {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }} +{% endmacro %} + + +{% macro default__length(expression) %} + + length( + {{ expression }} + ) + +{%- endmacro -%} + + +{% macro redshift__length(expression) %} + + len( + {{ expression }} + ) + +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/listagg.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/listagg.sql new file mode 100644 index 0000000..1d19a54 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/listagg.sql @@ -0,0 +1,104 @@ +{% macro listagg(measure, delimiter_text="','", order_by_clause=none, limit_num=none) -%} + {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }} +{%- endmacro %} + +{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%} + + {% if limit_num -%} + array_to_string( + array_slice( + array_agg( + {{ measure }} + ){% if order_by_clause -%} + within group ({{ order_by_clause }}) + {%- endif %} + ,0 + ,{{ limit_num }} + ), + {{ delimiter_text }} + ) + {%- else %} + listagg( + {{ measure }}, + {{ delimiter_text }} + ) + {% if order_by_clause -%} + within group ({{ order_by_clause }}) + {%- endif %} + {%- endif %} + +{%- endmacro %} + +{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%} + + string_agg( + {{ measure }}, + {{ delimiter_text }} + {% if order_by_clause -%} + {{ order_by_clause }} + {%- endif %} + {% if limit_num -%} + limit {{ limit_num }} + {%- endif %} + ) + +{%- endmacro %} + +{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%} + + {% if limit_num -%} + array_to_string( + (array_agg( + {{ measure }} + {% if order_by_clause -%} + {{ order_by_clause }} + {%- endif %} + ))[1:{{ limit_num }}], + {{ delimiter_text }} + ) + {%- else %} + string_agg( + {{ measure }}, + {{ delimiter_text }} + {% if order_by_clause -%} + {{ order_by_clause }} + {%- endif %} + ) + {%- endif %} + +{%- endmacro %} + +{# if there are instances of delimiter_text within your measure, you cannot include a limit_num #} +{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%} + + {% if limit_num -%} + {% set ns = namespace() %} + {% set ns.delimiter_text_regex = delimiter_text|trim("'") %} + {% set special_chars %}\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} + {%- for char in special_chars.split(',') -%} + {% set escape_char %}\\{{ char }}{% endset %} + {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %} + {%- endfor -%} + + {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %} + regexp_substr( + listagg( + {{ measure }}, + {{ delimiter_text }} + ) + {% if order_by_clause -%} + within group ({{ order_by_clause }}) + {%- endif %} + ,{{ regex }} + ) + {%- else %} + listagg( + {{ measure }}, + {{ delimiter_text }} + ) + {% if order_by_clause -%} + within group ({{ order_by_clause }}) + {%- endif %} + {%- endif %} + +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/literal.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/literal.sql new file mode 100644 index 0000000..c229146 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/literal.sql @@ -0,0 +1,8 @@ + +{%- macro string_literal(value) -%} + {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }} +{%- endmacro -%} + +{% macro default__string_literal(value) -%} + '{{ value }}' +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/position.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/position.sql new file mode 100644 index 0000000..a67b7aa --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/position.sql @@ -0,0 +1,22 @@ +{% macro position(substring_text, string_text) -%} + {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }} +{% endmacro %} + + +{% macro default__position(substring_text, string_text) %} + + position( + {{ substring_text }} in {{ string_text }} + ) + +{%- endmacro -%} + +{% macro bigquery__position(substring_text, string_text) %} + + strpos( + {{ string_text }}, + {{ substring_text }} + + ) + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/replace.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/replace.sql new file mode 100644 index 0000000..ef27d8f --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/replace.sql @@ -0,0 +1,15 @@ +{% macro replace(field, old_chars, new_chars) -%} + {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }} +{% endmacro %} + + +{% macro default__replace(field, old_chars, new_chars) %} + + replace( + {{ field }}, + {{ old_chars }}, + {{ new_chars }} + ) + + +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/right.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/right.sql new file mode 100644 index 0000000..8ae1640 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/right.sql @@ -0,0 +1,38 @@ +{% macro right(string_text, length_expression) -%} + {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }} +{% endmacro %} + +{% macro default__right(string_text, length_expression) %} + + right( + {{ string_text }}, + {{ length_expression }} + ) + +{%- endmacro -%} + +{% macro bigquery__right(string_text, length_expression) %} + + case when {{ length_expression }} = 0 + then '' + else + substr( + {{ string_text }}, + -1 * ({{ length_expression }}) + ) + end + +{%- endmacro -%} + +{% macro snowflake__right(string_text, length_expression) %} + + case when {{ length_expression }} = 0 + then '' + else + right( + {{ string_text }}, + {{ length_expression }} + ) + end + +{%- endmacro -%} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/safe_cast.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/safe_cast.sql new file mode 100644 index 0000000..8569eec --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/safe_cast.sql @@ -0,0 +1,20 @@ +{% macro safe_cast(field, type) %} + {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }} +{% endmacro %} + + +{% macro default__safe_cast(field, type) %} + {# most databases don't support this function yet + so we just need to use cast #} + cast({{field}} as {{type}}) +{% endmacro %} + + +{% macro snowflake__safe_cast(field, type) %} + try_cast({{field}} as {{type}}) +{% endmacro %} + + +{% macro bigquery__safe_cast(field, type) %} + safe_cast({{field}} as {{type}}) +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/split_part.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/split_part.sql new file mode 100644 index 0000000..2f9daea --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/split_part.sql @@ -0,0 +1,72 @@ +{% macro split_part(string_text, delimiter_text, part_number) %} + {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }} +{% endmacro %} + + +{% macro default__split_part(string_text, delimiter_text, part_number) %} + + split_part( + {{ string_text }}, + {{ delimiter_text }}, + {{ part_number }} + ) + +{% endmacro %} + + +{% macro _split_part_negative(string_text, delimiter_text, part_number) %} + + split_part( + {{ string_text }}, + {{ delimiter_text }}, + length({{ string_text }}) + - length( + replace({{ string_text }}, {{ delimiter_text }}, '') + ) + 2 {{ part_number }} + ) + +{% endmacro %} + + +{% macro postgres__split_part(string_text, delimiter_text, part_number) %} + + {% if part_number >= 0 %} + {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }} + {% else %} + {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }} + {% endif %} + +{% endmacro %} + + +{% macro redshift__split_part(string_text, delimiter_text, part_number) %} + + {% if part_number >= 0 %} + {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }} + {% else %} + {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }} + {% endif %} + +{% endmacro %} + + +{% macro bigquery__split_part(string_text, delimiter_text, part_number) %} + + {% if part_number >= 0 %} + split( + {{ string_text }}, + {{ delimiter_text }} + )[safe_offset({{ part_number - 1 }})] + {% else %} + split( + {{ string_text }}, + {{ delimiter_text }} + )[safe_offset( + length({{ string_text }}) + - length( + replace({{ string_text }}, {{ delimiter_text }}, '') + ) + 1 + )] + {% endif %} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/cross_db_utils/width_bucket.sql b/dbt_packages/dbt_utils/macros/cross_db_utils/width_bucket.sql new file mode 100644 index 0000000..fc8ae81 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/cross_db_utils/width_bucket.sql @@ -0,0 +1,59 @@ +{% macro width_bucket(expr, min_value, max_value, num_buckets) %} + {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }} +{% endmacro %} + + +{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%} + + {% set bin_size -%} + (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} ) + {%- endset %} + ( + -- to break ties when the amount is eaxtly at the bucket egde + case + when + mod( + {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }}, + {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }} + ) = 0 + then 1 + else 0 + end + ) + + -- Anything over max_value goes the N+1 bucket + least( + ceil( + ({{ expr }} - {{ min_value }})/{{ bin_size }} + ), + {{ num_buckets }} + 1 + ) +{%- endmacro %} + +{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%} + + {% set bin_size -%} + (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} ) + {%- endset %} + ( + -- to break ties when the amount is exactly at the bucket edge + case + when + {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} % + {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }} + = 0 + then 1 + else 0 + end + ) + + -- Anything over max_value goes the N+1 bucket + least( + ceil( + ({{ expr }} - {{ min_value }})/{{ bin_size }} + ), + {{ num_buckets }} + 1 + ) +{%- endmacro %} + +{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %} + width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} ) +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/accepted_range.sql b/dbt_packages/dbt_utils/macros/generic_tests/accepted_range.sql new file mode 100644 index 0000000..49ab00d --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/accepted_range.sql @@ -0,0 +1,33 @@ +{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %} + {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }} +{% endtest %} + +{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %} + +with meet_condition as( + select * + from {{ model }} +), + +validation_errors as ( + select * + from meet_condition + where + -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds + 1 = 2 + + {%- if min_value is not none %} + -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule. + or not {{ column_name }} > {{- "=" if inclusive }} {{ min_value }} + {%- endif %} + + {%- if max_value is not none %} + -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule. + or not {{ column_name }} < {{- "=" if inclusive }} {{ max_value }} + {%- endif %} +) + +select * +from validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/at_least_one.sql b/dbt_packages/dbt_utils/macros/generic_tests/at_least_one.sql new file mode 100644 index 0000000..ce02108 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/at_least_one.sql @@ -0,0 +1,20 @@ +{% test at_least_one(model, column_name) %} + {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }} +{% endtest %} + +{% macro default__test_at_least_one(model, column_name) %} + +select * +from ( + select + {# In TSQL, subquery aggregate columns need aliases #} + {# thus: a filler col name, 'filler_column' #} + count({{ column_name }}) as filler_column + + from {{ model }} + + having count({{ column_name }}) = 0 + +) validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/cardinality_equality.sql b/dbt_packages/dbt_utils/macros/generic_tests/cardinality_equality.sql new file mode 100644 index 0000000..4ec7d87 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/cardinality_equality.sql @@ -0,0 +1,53 @@ +{% test cardinality_equality(model, column_name, to, field) %} + {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }} +{% endtest %} + +{% macro default__test_cardinality_equality(model, column_name, to, field) %} + +{# T-SQL does not let you use numbers as aliases for columns #} +{# Thus, no "GROUP BY 1" #} + +with table_a as ( +select + {{ column_name }}, + count(*) as num_rows +from {{ model }} +group by {{ column_name }} +), + +table_b as ( +select + {{ field }}, + count(*) as num_rows +from {{ to }} +group by {{ field }} +), + +except_a as ( + select * + from table_a + {{ dbt_utils.except() }} + select * + from table_b +), + +except_b as ( + select * + from table_b + {{ dbt_utils.except() }} + select * + from table_a +), + +unioned as ( + select * + from except_a + union all + select * + from except_b +) + +select * +from unioned + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/equal_rowcount.sql b/dbt_packages/dbt_utils/macros/generic_tests/equal_rowcount.sql new file mode 100644 index 0000000..713cb12 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/equal_rowcount.sql @@ -0,0 +1,38 @@ +{% test equal_rowcount(model, compare_model) %} + {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }} +{% endtest %} + +{% macro default__test_equal_rowcount(model, compare_model) %} + +{#-- Needs to be set at parse time, before we return '' below --#} +{{ config(fail_calc = 'coalesce(diff_count, 0)') }} + +{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} +{%- if not execute -%} + {{ return('') }} +{% endif %} + +with a as ( + + select count(*) as count_a from {{ model }} + +), +b as ( + + select count(*) as count_b from {{ compare_model }} + +), +final as ( + + select + count_a, + count_b, + abs(count_a - count_b) as diff_count + from a + cross join b + +) + +select * from final + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/equality.sql b/dbt_packages/dbt_utils/macros/generic_tests/equality.sql new file mode 100644 index 0000000..bc302c1 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/equality.sql @@ -0,0 +1,75 @@ +{% test equality(model, compare_model, compare_columns=None) %} + {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }} +{% endtest %} + +{% macro default__test_equality(model, compare_model, compare_columns=None) %} + +{% set set_diff %} + count(*) + coalesce(abs( + sum(case when which_diff = 'a_minus_b' then 1 else 0 end) - + sum(case when which_diff = 'b_minus_a' then 1 else 0 end) + ), 0) +{% endset %} + +{#-- Needs to be set at parse time, before we return '' below --#} +{{ config(fail_calc = set_diff) }} + +{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} +{%- if not execute -%} + {{ return('') }} +{% endif %} + +-- setup +{%- do dbt_utils._is_relation(model, 'test_equality') -%} + +{#- +If the compare_cols arg is provided, we can run this test without querying the +information schema — this allows the model to be an ephemeral model +-#} + +{%- if not compare_columns -%} + {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%} + {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%} +{%- endif -%} + +{% set compare_cols_csv = compare_columns | join(', ') %} + +with a as ( + + select * from {{ model }} + +), + +b as ( + + select * from {{ compare_model }} + +), + +a_minus_b as ( + + select {{compare_cols_csv}} from a + {{ dbt_utils.except() }} + select {{compare_cols_csv}} from b + +), + +b_minus_a as ( + + select {{compare_cols_csv}} from b + {{ dbt_utils.except() }} + select {{compare_cols_csv}} from a + +), + +unioned as ( + + select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b + union all + select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a + +) + +select * from unioned + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/expression_is_true.sql b/dbt_packages/dbt_utils/macros/generic_tests/expression_is_true.sql new file mode 100644 index 0000000..611685b --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/expression_is_true.sql @@ -0,0 +1,22 @@ +{% test expression_is_true(model, expression, column_name=None, condition='1=1') %} +{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #} +{# ref https://stackoverflow.com/a/7170753/3842610 #} + {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }} +{% endtest %} + +{% macro default__test_expression_is_true(model, expression, column_name, condition) %} + +with meet_condition as ( + select * from {{ model }} where {{ condition }} +) + +select + * +from meet_condition +{% if column_name is none %} +where not({{ expression }}) +{%- else %} +where not({{ column_name }} {{ expression }}) +{%- endif %} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/fewer_rows_than.sql b/dbt_packages/dbt_utils/macros/generic_tests/fewer_rows_than.sql new file mode 100644 index 0000000..450148b --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/fewer_rows_than.sql @@ -0,0 +1,45 @@ +{% test fewer_rows_than(model, compare_model) %} + {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }} +{% endtest %} + +{% macro default__test_fewer_rows_than(model, compare_model) %} + +{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }} + +with a as ( + + select count(*) as count_our_model from {{ model }} + +), +b as ( + + select count(*) as count_comparison_model from {{ compare_model }} + +), +counts as ( + + select + count_our_model, + count_comparison_model + from a + cross join b + +), +final as ( + + select *, + case + -- fail the test if we have more rows than the reference model and return the row count delta + when count_our_model > count_comparison_model then (count_our_model - count_comparison_model) + -- fail the test if they are the same number + when count_our_model = count_comparison_model then 1 + -- pass the test if the delta is positive (i.e. return the number 0) + else 0 + end as row_count_delta + from counts + +) + +select * from final + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/mutually_exclusive_ranges.sql b/dbt_packages/dbt_utils/macros/generic_tests/mutually_exclusive_ranges.sql new file mode 100644 index 0000000..f88efbe --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/mutually_exclusive_ranges.sql @@ -0,0 +1,97 @@ +{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %} + {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }} +{% endtest %} + +{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %} +{% if gaps == 'not_allowed' %} + {% set allow_gaps_operator='=' %} + {% set allow_gaps_operator_in_words='equal_to' %} +{% elif gaps == 'allowed' %} + {% set allow_gaps_operator='<=' %} + {% set allow_gaps_operator_in_words='less_than_or_equal_to' %} +{% elif gaps == 'required' %} + {% set allow_gaps_operator='<' %} + {% set allow_gaps_operator_in_words='less_than' %} +{% else %} + {{ exceptions.raise_compiler_error( + "`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '" ~ gaps ~"'.'" + ) }} +{% endif %} +{% if not zero_length_range_allowed %} + {% set allow_zero_length_operator='<' %} + {% set allow_zero_length_operator_in_words='less_than' %} +{% elif zero_length_range_allowed %} + {% set allow_zero_length_operator='<=' %} + {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %} +{% else %} + {{ exceptions.raise_compiler_error( + "`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '" ~ zero_length_range_allowed ~"'.'" + ) }} +{% endif %} + +{% set partition_clause="partition by " ~ partition_by if partition_by else '' %} + +with window_functions as ( + + select + {% if partition_by %} + {{ partition_by }} as partition_by_col, + {% endif %} + {{ lower_bound_column }} as lower_bound, + {{ upper_bound_column }} as upper_bound, + + lead({{ lower_bound_column }}) over ( + {{ partition_clause }} + order by {{ lower_bound_column }} + ) as next_lower_bound, + + row_number() over ( + {{ partition_clause }} + order by {{ lower_bound_column }} desc + ) = 1 as is_last_record + + from {{ model }} + +), + +calc as ( + -- We want to return records where one of our assumptions fails, so we'll use + -- the `not` function with `and` statements so we can write our assumptions nore cleanly + select + *, + + -- For each record: lower_bound should be < upper_bound. + -- Coalesce it to return an error on the null case (implicit assumption + -- these columns are not_null) + coalesce( + lower_bound {{ allow_zero_length_operator }} upper_bound, + false + ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound, + + -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound. + -- Coalesce it to handle null cases for the last record. + coalesce( + upper_bound {{ allow_gaps_operator }} next_lower_bound, + is_last_record, + false + ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound + + from window_functions + +), + +validation_errors as ( + + select + * + from calc + + where not( + -- THE FOLLOWING SHOULD BE TRUE -- + lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound + and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound + ) +) + +select * from validation_errors +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/not_accepted_values.sql b/dbt_packages/dbt_utils/macros/generic_tests/not_accepted_values.sql new file mode 100644 index 0000000..ab24188 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/not_accepted_values.sql @@ -0,0 +1,37 @@ +{% test not_accepted_values(model, column_name, values, quote=True) %} + {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }} +{% endtest %} + +{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %} +with all_values as ( + + select distinct + {{ column_name }} as value_field + + from {{ model }} + +), + +validation_errors as ( + + select + value_field + + from all_values + where value_field in ( + {% for value in values -%} + {% if quote -%} + '{{ value }}' + {%- else -%} + {{ value }} + {%- endif -%} + {%- if not loop.last -%},{%- endif %} + {%- endfor %} + ) + +) + +select * +from validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/not_constant.sql b/dbt_packages/dbt_utils/macros/generic_tests/not_constant.sql new file mode 100644 index 0000000..781ed7d --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/not_constant.sql @@ -0,0 +1,19 @@ + +{% test not_constant(model, column_name) %} + {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }} +{% endtest %} + +{% macro default__test_not_constant(model, column_name) %} + + +select + {# In TSQL, subquery aggregate columns need aliases #} + {# thus: a filler col name, 'filler_column' #} + count(distinct {{ column_name }}) as filler_column + +from {{ model }} + +having count(distinct {{ column_name }}) = 1 + + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/not_null_proportion.sql b/dbt_packages/dbt_utils/macros/generic_tests/not_null_proportion.sql new file mode 100644 index 0000000..45b9050 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/not_null_proportion.sql @@ -0,0 +1,26 @@ +{% macro test_not_null_proportion(model) %} + {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }} +{% endmacro %} + +{% macro default__test_not_null_proportion(model) %} + +{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %} +{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %} +{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %} + +with validation as ( + select + sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion + from {{ model }} +), +validation_errors as ( + select + not_null_proportion + from validation + where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }} +) +select + * +from validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/recency.sql b/dbt_packages/dbt_utils/macros/generic_tests/recency.sql new file mode 100644 index 0000000..cb9a8de --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/recency.sql @@ -0,0 +1,24 @@ +{% test recency(model, field, datepart, interval) %} + {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }} +{% endtest %} + +{% macro default__test_recency(model, field, datepart, interval) %} + +{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %} + +with recency as ( + + select max({{field}}) as most_recent + from {{ model }} + +) + +select + + most_recent, + {{ threshold }} as threshold + +from recency +where most_recent < {{ threshold }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/relationships_where.sql b/dbt_packages/dbt_utils/macros/generic_tests/relationships_where.sql new file mode 100644 index 0000000..c35a380 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/relationships_where.sql @@ -0,0 +1,51 @@ +{% test relationships_where(model, column_name, to, field, from_condition="1=1", to_condition="1=1") %} + {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }} +{% endtest %} + +{% macro default__test_relationships_where(model, column_name, to, field, from_condition="1=1", to_condition="1=1") %} + +{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #} +{# ref https://stackoverflow.com/a/7170753/3842610 #} + +with left_table as ( + + select + {{column_name}} as id + + from {{model}} + + where {{column_name}} is not null + and {{from_condition}} + +), + +right_table as ( + + select + {{field}} as id + + from {{to}} + + where {{field}} is not null + and {{to_condition}} + +), + +exceptions as ( + + select + left_table.id, + right_table.id as right_id + + from left_table + + left join right_table + on left_table.id = right_table.id + + where right_table.id is null + +) + +select * from exceptions + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/sequential_values.sql b/dbt_packages/dbt_utils/macros/generic_tests/sequential_values.sql new file mode 100644 index 0000000..8ddae70 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/sequential_values.sql @@ -0,0 +1,35 @@ +{% test sequential_values(model, column_name, interval=1, datepart=None) %} + + {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }} + +{% endtest %} + +{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %} + +{% set previous_column_name = "previous_" ~ dbt_utils.slugify(column_name) %} + +with windowed as ( + + select + {{ column_name }}, + lag({{ column_name }}) over ( + order by {{ column_name }} + ) as {{ previous_column_name }} + from {{ model }} +), + +validation_errors as ( + select + * + from windowed + {% if datepart %} + where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }})) + {% else %} + where not({{ column_name }} = {{ previous_column_name }} + {{ interval }}) + {% endif %} +) + +select * +from validation_errors + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/test_not_null_where.sql b/dbt_packages/dbt_utils/macros/generic_tests/test_not_null_where.sql new file mode 100644 index 0000000..d5dbf6c --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/test_not_null_where.sql @@ -0,0 +1,12 @@ +{% test not_null_where(model, column_name) %} + {%- set deprecation_warning = ' + Warning: `dbt_utils.not_null_where` is no longer supported. + Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config. + ' -%} + {%- do exceptions.warn(deprecation_warning) -%} + {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }} +{% endtest %} + +{% macro default__test_not_null_where(model, column_name) %} + {{ return(test_not_null(model, column_name)) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/test_unique_where.sql b/dbt_packages/dbt_utils/macros/generic_tests/test_unique_where.sql new file mode 100644 index 0000000..e752d7b --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/test_unique_where.sql @@ -0,0 +1,12 @@ +{% test unique_where(model, column_name) %} + {%- set deprecation_warning = ' + Warning: `dbt_utils.unique_where` is no longer supported. + Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config. + ' -%} + {%- do exceptions.warn(deprecation_warning) -%} + {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }} +{% endtest %} + +{% macro default__test_unique_where(model, column_name) %} + {{ return(test_unique(model, column_name)) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/generic_tests/unique_combination_of_columns.sql b/dbt_packages/dbt_utils/macros/generic_tests/unique_combination_of_columns.sql new file mode 100644 index 0000000..74ccf5c --- /dev/null +++ b/dbt_packages/dbt_utils/macros/generic_tests/unique_combination_of_columns.sql @@ -0,0 +1,37 @@ +{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %} + {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }} +{% endtest %} + +{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %} + +{% if not quote_columns %} + {%- set column_list=combination_of_columns %} +{% elif quote_columns %} + {%- set column_list=[] %} + {% for column in combination_of_columns -%} + {% set column_list = column_list.append( adapter.quote(column) ) %} + {%- endfor %} +{% else %} + {{ exceptions.raise_compiler_error( + "`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '" ~ quote ~"'.'" + ) }} +{% endif %} + +{%- set columns_csv=column_list | join(', ') %} + + +with validation_errors as ( + + select + {{ columns_csv }} + from {{ model }} + group by {{ columns_csv }} + having count(*) > 1 + +) + +select * +from validation_errors + + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/jinja_helpers/log_info.sql b/dbt_packages/dbt_utils/macros/jinja_helpers/log_info.sql new file mode 100644 index 0000000..52b4b4a --- /dev/null +++ b/dbt_packages/dbt_utils/macros/jinja_helpers/log_info.sql @@ -0,0 +1,7 @@ +{% macro log_info(message) %} + {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }} +{% endmacro %} + +{% macro default__log_info(message) %} + {{ log(dbt_utils.pretty_log_format(message), info=True) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_log_format.sql b/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_log_format.sql new file mode 100644 index 0000000..fe580d1 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_log_format.sql @@ -0,0 +1,7 @@ +{% macro pretty_log_format(message) %} + {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }} +{% endmacro %} + +{% macro default__pretty_log_format(message) %} + {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_time.sql b/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_time.sql new file mode 100644 index 0000000..bad37ef --- /dev/null +++ b/dbt_packages/dbt_utils/macros/jinja_helpers/pretty_time.sql @@ -0,0 +1,7 @@ +{% macro pretty_time(format='%H:%M:%S') %} + {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }} +{% endmacro %} + +{% macro default__pretty_time(format='%H:%M:%S') %} + {{ return(modules.datetime.datetime.now().strftime(format)) }} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/jinja_helpers/slugify.sql b/dbt_packages/dbt_utils/macros/jinja_helpers/slugify.sql new file mode 100644 index 0000000..1b3c727 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/jinja_helpers/slugify.sql @@ -0,0 +1,12 @@ +{% macro slugify(string) %} + +{#- Lower case the string -#} +{% set string = string | lower %} +{#- Replace spaces and dashes with underscores -#} +{% set string = modules.re.sub('[ -]+', '_', string) %} +{#- Only take letters, numbers, and underscores -#} +{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %} + +{{ return(string) }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/materializations/insert_by_period_materialization.sql b/dbt_packages/dbt_utils/macros/materializations/insert_by_period_materialization.sql new file mode 100644 index 0000000..5a15c81 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/materializations/insert_by_period_materialization.sql @@ -0,0 +1,189 @@ +{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%} + {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }} +{% endmacro %} + +{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%} + + {% call statement('period_boundaries', fetch_result=True) -%} + with data as ( + select + coalesce(max("{{timestamp_field}}"), '{{start_date}}')::timestamp as start_timestamp, + coalesce( + {{dbt_utils.dateadd('millisecond', + -1, + "nullif('" ~ stop_date ~ "','')::timestamp")}}, + {{dbt_utils.current_timestamp()}} + ) as stop_timestamp + from "{{target_schema}}"."{{target_table}}" + ) + + select + start_timestamp, + stop_timestamp, + {{dbt_utils.datediff('start_timestamp', + 'stop_timestamp', + period)}} + 1 as num_periods + from data + {%- endcall %} + +{%- endmacro %} + +{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%} + {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }} +{% endmacro %} + +{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%} + + {%- set period_filter -%} + ("{{timestamp_field}}" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and + "{{timestamp_field}}" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and + "{{timestamp_field}}" < '{{stop_timestamp}}'::timestamp) + {%- endset -%} + + {%- set filtered_sql = sql | replace("__PERIOD_FILTER__", period_filter) -%} + + select + {{target_cols_csv}} + from ( + {{filtered_sql}} + ) + +{%- endmacro %} + +{% materialization insert_by_period, default -%} + {%- set timestamp_field = config.require('timestamp_field') -%} + {%- set start_date = config.require('start_date') -%} + {%- set stop_date = config.get('stop_date') or '' -%} + {%- set period = config.get('period') or 'week' -%} + + {%- if sql.find('__PERIOD_FILTER__') == -1 -%} + {%- set error_message -%} + Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql + {%- endset -%} + {{ exceptions.raise_compiler_error(error_message) }} + {%- endif -%} + + {%- set identifier = model['name'] -%} + + {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%} + {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%} + + {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%} + {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%} + + {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%} + {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%} + + {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%} + {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%} + {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%} + + -- setup + {% if old_relation is none -%} + -- noop + {%- elif should_truncate -%} + {{adapter.truncate_relation(old_relation)}} + {%- elif should_drop -%} + {{adapter.drop_relation(old_relation)}} + {%- set old_relation = none -%} + {%- endif %} + + {{run_hooks(pre_hooks, inside_transaction=False)}} + + -- `begin` happens here, so `commit` after it to finish the transaction + {{run_hooks(pre_hooks, inside_transaction=True)}} + {% call statement() -%} + begin; -- make extra sure we've closed out the transaction + commit; + {%- endcall %} + + -- build model + {% if force_create or old_relation is none -%} + {# Create an empty target table -#} + {% call statement('main') -%} + {%- set empty_sql = sql | replace("__PERIOD_FILTER__", 'false') -%} + {{create_table_as(False, target_relation, empty_sql)}} + {%- endcall %} + {%- endif %} + + {% set _ = dbt_utils.get_period_boundaries(schema, + identifier, + timestamp_field, + start_date, + stop_date, + period) %} + {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%} + {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%} + {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%} + + {% set target_columns = adapter.get_columns_in_relation(target_relation) %} + {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%} + {%- set loop_vars = {'sum_rows_inserted': 0} -%} + + -- commit each period as a separate transaction + {% for i in range(num_periods) -%} + {%- set msg = "Running for " ~ period ~ " " ~ (i + 1) ~ " of " ~ (num_periods) -%} + {{ dbt_utils.log_info(msg) }} + + {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%} + {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier, + schema=schema, type='table') -%} + {% call statement() -%} + {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv, + sql, + timestamp_field, + period, + start_timestamp, + stop_timestamp, + i) %} + {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}} + {%- endcall %} + + {{adapter.expand_target_column_types(from_relation=tmp_relation, + to_relation=target_relation)}} + {%- set name = 'main-' ~ i -%} + {% call statement(name, fetch_result=True) -%} + insert into {{target_relation}} ({{target_cols_csv}}) + ( + select + {{target_cols_csv}} + from {{tmp_relation.include(schema=False)}} + ); + {%- endcall %} + {% set result = load_result('main-' ~ i) %} + {% if 'response' in result.keys() %} {# added in v0.19.0 #} + {% set rows_inserted = result['response']['rows_affected'] %} + {% else %} {# older versions #} + {% set rows_inserted = result['status'].split(" ")[2] | int %} + {% endif %} + + {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%} + {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%} + + {%- set msg = "Ran for " ~ period ~ " " ~ (i + 1) ~ " of " ~ (num_periods) ~ "; " ~ rows_inserted ~ " records inserted" -%} + {{ dbt_utils.log_info(msg) }} + + {%- endfor %} + + {% call statement() -%} + begin; + {%- endcall %} + + {{run_hooks(post_hooks, inside_transaction=True)}} + + {% call statement() -%} + commit; + {%- endcall %} + + {{run_hooks(post_hooks, inside_transaction=False)}} + + {%- set status_string = "INSERT " ~ loop_vars['sum_rows_inserted'] -%} + + {% call noop_statement('main', status_string) -%} + -- no-op + {%- endcall %} + + -- Return the relations created in this materialization + {{ return({'relations': [target_relation]}) }} + +{%- endmaterialization %} diff --git a/dbt_packages/dbt_utils/macros/sql/date_spine.sql b/dbt_packages/dbt_utils/macros/sql/date_spine.sql new file mode 100644 index 0000000..759f8d5 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/date_spine.sql @@ -0,0 +1,75 @@ +{% macro get_intervals_between(start_date, end_date, datepart) -%} + {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }} +{%- endmacro %} + +{% macro default__get_intervals_between(start_date, end_date, datepart) -%} + {%- call statement('get_intervals_between', fetch_result=True) %} + + select {{dbt_utils.datediff(start_date, end_date, datepart)}} + + {%- endcall -%} + + {%- set value_list = load_result('get_intervals_between') -%} + + {%- if value_list and value_list['data'] -%} + {%- set values = value_list['data'] | map(attribute=0) | list %} + {{ return(values[0]) }} + {%- else -%} + {{ return(1) }} + {%- endif -%} + +{%- endmacro %} + + + + +{% macro date_spine(datepart, start_date, end_date) %} + {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }} +{%- endmacro %} + +{% macro default__date_spine(datepart, start_date, end_date) %} + + +{# call as follows: + +date_spine( + "day", + "to_date('01/01/2016', 'mm/dd/yyyy')", + "dateadd(week, 1, current_date)" +) #} + + +with rawdata as ( + + {{dbt_utils.generate_series( + dbt_utils.get_intervals_between(start_date, end_date, datepart) + )}} + +), + +all_periods as ( + + select ( + {{ + dbt_utils.dateadd( + datepart, + "row_number() over (order by 1) - 1", + start_date + ) + }} + ) as date_{{datepart}} + from rawdata + +), + +filtered as ( + + select * + from all_periods + where date_{{datepart}} <= {{ end_date }} + +) + +select * from filtered + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/deduplicate.sql b/dbt_packages/dbt_utils/macros/sql/deduplicate.sql new file mode 100644 index 0000000..6450174 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/deduplicate.sql @@ -0,0 +1,122 @@ +{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%} + + {%- set error_message_group_by -%} +Warning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils. +Use `partition_by` instead. +The {{ model.package_name }}.{{ model.name }} model triggered this warning. + {%- endset -%} + + {% if kwargs.get('group_by') %} + {%- do exceptions.warn(error_message_group_by) -%} + {%- endif -%} + + {%- set error_message_order_by -%} +Warning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils. +Supply a non-null value for `order_by` instead. +The {{ model.package_name }}.{{ model.name }} model triggered this warning. + {%- endset -%} + + {% if not order_by %} + {%- do exceptions.warn(error_message_order_by) -%} + {%- endif -%} + + {%- set error_message_alias -%} +Warning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils. +If you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead. +The {{ model.package_name }}.{{ model.name }} model triggered this warning. + {%- endset -%} + + {% if relation_alias %} + {%- do exceptions.warn(error_message_alias) -%} + {%- endif -%} + + {% set partition_by = partition_by or kwargs.get('group_by') %} + {% set relation = relation_alias or relation %} + {% set order_by = order_by or "'1'" %} + + {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }} +{% endmacro %} + +{%- macro default__deduplicate(relation, partition_by, order_by) -%} + + with row_numbered as ( + select + _inner.*, + row_number() over ( + partition by {{ partition_by }} + order by {{ order_by }} + ) as rn + from {{ relation }} as _inner + ) + + select + distinct data.* + from {{ relation }} as data + {# + -- Not all DBs will support natural joins but the ones that do include: + -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks + -- Apache Spark, SingleStore, Vertica + -- Those that do not appear to support natural joins include: + -- SQLServer, Trino, Presto, Rockset, Athena + #} + natural join row_numbered + where row_numbered.rn = 1 + +{%- endmacro -%} + +{# Redshift should use default instead of Postgres #} +{% macro redshift__deduplicate(relation, partition_by, order_by) -%} + + {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }} + +{% endmacro %} + +{# +-- Postgres has the `DISTINCT ON` syntax: +-- https://www.postgresql.org/docs/current/sql-select.html#SQL-DISTINCT +#} +{%- macro postgres__deduplicate(relation, partition_by, order_by) -%} + + select + distinct on ({{ partition_by }}) * + from {{ relation }} + order by {{ partition_by }}{{ ',' ~ order_by }} + +{%- endmacro -%} + +{# +-- Snowflake has the `QUALIFY` syntax: +-- https://docs.snowflake.com/en/sql-reference/constructs/qualify.html +#} +{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%} + + select * + from {{ relation }} + qualify + row_number() over ( + partition by {{ partition_by }} + order by {{ order_by }} + ) = 1 + +{%- endmacro -%} + +{# +-- It is more performant to deduplicate using `array_agg` with a limit +-- clause in BigQuery: +-- https://github.com/dbt-labs/dbt-utils/issues/335#issuecomment-788157572 +#} +{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%} + + select unique.* + from ( + select + array_agg ( + original + order by {{ order_by }} + limit 1 + )[offset(0)] unique + from {{ relation }} original + group by {{ partition_by }} + ) + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/sql/generate_series.sql b/dbt_packages/dbt_utils/macros/sql/generate_series.sql new file mode 100644 index 0000000..efcbd8a --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/generate_series.sql @@ -0,0 +1,53 @@ +{% macro get_powers_of_two(upper_bound) %} + {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }} +{% endmacro %} + +{% macro default__get_powers_of_two(upper_bound) %} + + {% if upper_bound <= 0 %} + {{ exceptions.raise_compiler_error("upper bound must be positive") }} + {% endif %} + + {% for _ in range(1, 100) %} + {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %} + {% endfor %} + +{% endmacro %} + + +{% macro generate_series(upper_bound) %} + {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }} +{% endmacro %} + +{% macro default__generate_series(upper_bound) %} + + {% set n = dbt_utils.get_powers_of_two(upper_bound) %} + + with p as ( + select 0 as generated_number union all select 1 + ), unioned as ( + + select + + {% for i in range(n) %} + p{{i}}.generated_number * power(2, {{i}}) + {% if not loop.last %} + {% endif %} + {% endfor %} + + 1 + as generated_number + + from + + {% for i in range(n) %} + p as p{{i}} + {% if not loop.last %} cross join {% endif %} + {% endfor %} + + ) + + select * + from unioned + where generated_number <= {{upper_bound}} + order by generated_number + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_column_values.sql b/dbt_packages/dbt_utils/macros/sql/get_column_values.sql new file mode 100644 index 0000000..d1dcf5d --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_column_values.sql @@ -0,0 +1,65 @@ +{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%} + {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }} +{% endmacro %} + +{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%} + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} + {%- if not execute -%} + {% set default = [] if not default %} + {{ return(default) }} + {% endif %} + + {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%} + + {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #} + {# TODO: Change the method signature in a future 0.x.0 release #} + {%- set target_relation = table -%} + + {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #} + {% set relation_exists = (load_relation(target_relation)) is not none %} + + {%- call statement('get_column_values', fetch_result=true) %} + + {%- if not relation_exists and default is none -%} + + {{ exceptions.raise_compiler_error("In get_column_values(): relation " ~ target_relation ~ " does not exist and no default value was provided.") }} + + {%- elif not relation_exists and default is not none -%} + + {{ log("Relation " ~ target_relation ~ " does not exist. Returning the default value: " ~ default) }} + + {{ return(default) }} + + {%- else -%} + + + select + {{ column }} as value + + from {{ target_relation }} + + {% if where is not none %} + where {{ where }} + {% endif %} + + group by {{ column }} + order by {{ order_by }} + + {% if max_records is not none %} + limit {{ max_records }} + {% endif %} + + {% endif %} + + {%- endcall -%} + + {%- set value_list = load_result('get_column_values') -%} + + {%- if value_list and value_list['data'] -%} + {%- set values = value_list['data'] | map(attribute=0) | list %} + {{ return(values) }} + {%- else -%} + {{ return(default) }} + {%- endif -%} + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_filtered_columns_in_relation.sql b/dbt_packages/dbt_utils/macros/sql/get_filtered_columns_in_relation.sql new file mode 100644 index 0000000..7f4af88 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_filtered_columns_in_relation.sql @@ -0,0 +1,25 @@ +{% macro get_filtered_columns_in_relation(from, except=[]) -%} + {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }} +{% endmacro %} + +{% macro default__get_filtered_columns_in_relation(from, except=[]) -%} + {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%} + {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%} + + {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} + {%- if not execute -%} + {{ return('') }} + {% endif %} + + {%- set include_cols = [] %} + {%- set cols = adapter.get_columns_in_relation(from) -%} + {%- set except = except | map("lower") | list %} + {%- for col in cols -%} + {%- if col.column|lower not in except -%} + {% do include_cols.append(col.column) %} + {%- endif %} + {%- endfor %} + + {{ return(include_cols) }} + +{%- endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/sql/get_query_results_as_dict.sql b/dbt_packages/dbt_utils/macros/sql/get_query_results_as_dict.sql new file mode 100644 index 0000000..6548f2d --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_query_results_as_dict.sql @@ -0,0 +1,26 @@ +{% macro get_query_results_as_dict(query) %} + {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }} +{% endmacro %} + +{% macro default__get_query_results_as_dict(query) %} + +{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #} + + {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%} + + {{ query }} + + {%- endcall -%} + + {% set sql_results={} %} + + {%- if execute -%} + {% set sql_results_table = load_result('get_query_results').table.columns %} + {% for column_name, column in sql_results_table.items() %} + {% do sql_results.update({column_name: column.values()}) %} + {% endfor %} + {%- endif -%} + + {{ return(sql_results) }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_relations_by_pattern.sql b/dbt_packages/dbt_utils/macros/sql/get_relations_by_pattern.sql new file mode 100644 index 0000000..9325a88 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_relations_by_pattern.sql @@ -0,0 +1,32 @@ +{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %} + {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }} +{% endmacro %} + +{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %} + + {%- call statement('get_tables', fetch_result=True) %} + + {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }} + + {%- endcall -%} + + {%- set table_list = load_result('get_tables') -%} + + {%- if table_list and table_list['table'] -%} + {%- set tbl_relations = [] -%} + {%- for row in table_list['table'] -%} + {%- set tbl_relation = api.Relation.create( + database=database, + schema=row.table_schema, + identifier=row.table_name, + type=row.table_type + ) -%} + {%- do tbl_relations.append(tbl_relation) -%} + {%- endfor -%} + + {{ return(tbl_relations) }} + {%- else -%} + {{ return([]) }} + {%- endif -%} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_relations_by_prefix.sql b/dbt_packages/dbt_utils/macros/sql/get_relations_by_prefix.sql new file mode 100644 index 0000000..b6733c4 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_relations_by_prefix.sql @@ -0,0 +1,32 @@ +{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %} + {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }} +{% endmacro %} + +{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %} + + {%- call statement('get_tables', fetch_result=True) %} + + {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }} + + {%- endcall -%} + + {%- set table_list = load_result('get_tables') -%} + + {%- if table_list and table_list['table'] -%} + {%- set tbl_relations = [] -%} + {%- for row in table_list['table'] -%} + {%- set tbl_relation = api.Relation.create( + database=database, + schema=row.table_schema, + identifier=row.table_name, + type=row.table_type + ) -%} + {%- do tbl_relations.append(tbl_relation) -%} + {%- endfor -%} + + {{ return(tbl_relations) }} + {%- else -%} + {{ return([]) }} + {%- endif -%} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_table_types_sql.sql b/dbt_packages/dbt_utils/macros/sql/get_table_types_sql.sql new file mode 100644 index 0000000..9157377 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_table_types_sql.sql @@ -0,0 +1,31 @@ +{%- macro get_table_types_sql() -%} + {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }} +{%- endmacro -%} + +{% macro default__get_table_types_sql() %} + case table_type + when 'BASE TABLE' then 'table' + when 'EXTERNAL TABLE' then 'external' + when 'MATERIALIZED VIEW' then 'materializedview' + else lower(table_type) + end as "table_type" +{% endmacro %} + + +{% macro postgres__get_table_types_sql() %} + case table_type + when 'BASE TABLE' then 'table' + when 'FOREIGN' then 'external' + when 'MATERIALIZED VIEW' then 'materializedview' + else lower(table_type) + end as "table_type" +{% endmacro %} + +{% macro bigquery__get_table_types_sql() %} + case table_type + when 'BASE TABLE' then 'table' + when 'EXTERNAL TABLE' then 'external' + when 'MATERIALIZED VIEW' then 'materializedview' + else lower(table_type) + end as `table_type` +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/dbt_utils/macros/sql/get_tables_by_pattern_sql.sql b/dbt_packages/dbt_utils/macros/sql/get_tables_by_pattern_sql.sql new file mode 100644 index 0000000..4d5a8fc --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_tables_by_pattern_sql.sql @@ -0,0 +1,70 @@ +{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %} + {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils') + (schema_pattern, table_pattern, exclude, database)) }} +{% endmacro %} + +{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %} + + select distinct + table_schema as "table_schema", + table_name as "table_name", + {{ dbt_utils.get_table_types_sql() }} + from {{ database }}.information_schema.tables + where table_schema ilike '{{ schema_pattern }}' + and table_name ilike '{{ table_pattern }}' + and table_name not ilike '{{ exclude }}' + +{% endmacro %} + + +{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %} + + {% if '%' in schema_pattern %} + {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %} + {% else %} + {% set schemata=[schema_pattern] %} + {% endif %} + + {% set sql %} + {% for schema in schemata %} + select distinct + table_schema, + table_name, + {{ dbt_utils.get_table_types_sql() }} + + from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES + where lower(table_name) like lower ('{{ table_pattern }}') + and lower(table_name) not like lower ('{{ exclude }}') + + {% if not loop.last %} union all {% endif %} + + {% endfor %} + {% endset %} + + {{ return(sql) }} + +{% endmacro %} + + +{% macro _bigquery__get_matching_schemata(schema_pattern, database) %} + {% if execute %} + + {% set sql %} + select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA + where lower(schema_name) like lower('{{ schema_pattern }}') + {% endset %} + + {% set results=run_query(sql) %} + + {% set schemata=results.columns['schema_name'].values() %} + + {{ return(schemata) }} + + {% else %} + + {{ return([]) }} + + {% endif %} + + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/get_tables_by_prefix_sql.sql b/dbt_packages/dbt_utils/macros/sql/get_tables_by_prefix_sql.sql new file mode 100644 index 0000000..f8fdfba --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/get_tables_by_prefix_sql.sql @@ -0,0 +1,14 @@ +{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %} + {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }} +{% endmacro %} + +{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %} + + {{ dbt_utils.get_tables_by_pattern_sql( + schema_pattern = schema, + table_pattern = prefix ~ '%', + exclude = exclude, + database = database + ) }} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/groupby.sql b/dbt_packages/dbt_utils/macros/sql/groupby.sql new file mode 100644 index 0000000..68a68cf --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/groupby.sql @@ -0,0 +1,11 @@ +{%- macro group_by(n) -%} + {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }} +{% endmacro %} + +{%- macro default__group_by(n) -%} + + group by {% for i in range(1, n + 1) -%} + {{ i }}{{ ',' if not loop.last }} + {%- endfor -%} + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/sql/haversine_distance.sql b/dbt_packages/dbt_utils/macros/sql/haversine_distance.sql new file mode 100644 index 0000000..70f276e --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/haversine_distance.sql @@ -0,0 +1,51 @@ +{# +This calculates the distance between two sets of latitude and longitude. +The formula is from the following blog post: +http://daynebatten.com/2015/09/latitude-longitude-distance-sql/ + +The arguments should be float type. +#} + +{% macro degrees_to_radians(degrees) -%} + acos(-1) * {{degrees}} / 180 +{%- endmacro %} + +{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%} + {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }} +{% endmacro %} + +{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%} +{%- if unit == 'mi' %} + {% set conversion_rate = 1 %} +{% elif unit == 'km' %} + {% set conversion_rate = 1.60934 %} +{% else %} + {{ exceptions.raise_compiler_error("unit input must be one of 'mi' or 'km'. Got " ~ unit) }} +{% endif %} + + 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) + + cos(radians({{lat1}})) * cos(radians({{lat2}})) * + power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }} + +{%- endmacro %} + + + +{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%} +{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %} +{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %} +{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %} +{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %} +{%- if unit == 'mi' %} + {% set conversion_rate = 1 %} +{% elif unit == 'km' %} + {% set conversion_rate = 1.60934 %} +{% else %} + {{ exceptions.raise_compiler_error("unit input must be one of 'mi' or 'km'. Got " ~ unit) }} +{% endif %} + 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) + + cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) * + power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }} + +{%- endmacro %} + diff --git a/dbt_packages/dbt_utils/macros/sql/nullcheck.sql b/dbt_packages/dbt_utils/macros/sql/nullcheck.sql new file mode 100644 index 0000000..509d24f --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/nullcheck.sql @@ -0,0 +1,21 @@ +{% macro nullcheck(cols) %} + {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }} +{% endmacro %} + +{% macro default__nullcheck(cols) %} +{%- for col in cols %} + + {% if col.is_string() -%} + + nullif({{col.name}},'') as {{col.name}} + + {%- else -%} + + {{col.name}} + + {%- endif -%} + +{%- if not loop.last -%} , {%- endif -%} + +{%- endfor -%} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/nullcheck_table.sql b/dbt_packages/dbt_utils/macros/sql/nullcheck_table.sql new file mode 100644 index 0000000..c9ab583 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/nullcheck_table.sql @@ -0,0 +1,14 @@ +{% macro nullcheck_table(relation) %} + {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }} +{% endmacro %} + +{% macro default__nullcheck_table(relation) %} + + {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%} + {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%} + {% set cols = adapter.get_columns_in_relation(relation) %} + + select {{ dbt_utils.nullcheck(cols) }} + from {{relation}} + +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/pivot.sql b/dbt_packages/dbt_utils/macros/sql/pivot.sql new file mode 100644 index 0000000..8875106 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/pivot.sql @@ -0,0 +1,86 @@ +{# +Pivot values from rows to columns. + +Example: + + Input: `public.test` + + | size | color | + |------+-------| + | S | red | + | S | blue | + | S | red | + | M | red | + + select + size, + {{ dbt_utils.pivot('color', dbt_utils.get_column_values('public.test', + 'color')) }} + from public.test + group by size + + Output: + + | size | red | blue | + |------+-----+------| + | S | 2 | 1 | + | M | 1 | 0 | + +Arguments: + column: Column name, required + values: List of row values to turn into columns, required + alias: Whether to create column aliases, default is True + agg: SQL aggregation function, default is sum + cmp: SQL value comparison, default is = + prefix: Column alias prefix, default is blank + suffix: Column alias postfix, default is blank + then_value: Value to use if comparison succeeds, default is 1 + else_value: Value to use if comparison fails, default is 0 + quote_identifiers: Whether to surround column aliases with double quotes, default is true + distinct: Whether to use distinct in the aggregation, default is False +#} + +{% macro pivot(column, + values, + alias=True, + agg='sum', + cmp='=', + prefix='', + suffix='', + then_value=1, + else_value=0, + quote_identifiers=True, + distinct=False) %} + {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }} +{% endmacro %} + +{% macro default__pivot(column, + values, + alias=True, + agg='sum', + cmp='=', + prefix='', + suffix='', + then_value=1, + else_value=0, + quote_identifiers=True, + distinct=False) %} + {% for value in values %} + {{ agg }}( + {% if distinct %} distinct {% endif %} + case + when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}' + then {{ then_value }} + else {{ else_value }} + end + ) + {% if alias %} + {% if quote_identifiers %} + as {{ adapter.quote(prefix ~ value ~ suffix) }} + {% else %} + as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }} + {% endif %} + {% endif %} + {% if not loop.last %},{% endif %} + {% endfor %} +{% endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/safe_add.sql b/dbt_packages/dbt_utils/macros/sql/safe_add.sql new file mode 100644 index 0000000..3b6195c --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/safe_add.sql @@ -0,0 +1,20 @@ +{%- macro safe_add() -%} + {# needed for safe_add to allow for non-keyword arguments see SO post #} + {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #} + {% set frustrating_jinja_feature = varargs %} + {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }} +{% endmacro %} + +{%- macro default__safe_add() -%} + +{% set fields = [] %} + +{%- for field in varargs -%} + + {% do fields.append("coalesce(" ~ field ~ ", 0)") %} + +{%- endfor -%} + +{{ fields|join(' +\n ') }} + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/sql/star.sql b/dbt_packages/dbt_utils/macros/sql/star.sql new file mode 100644 index 0000000..e083327 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/star.sql @@ -0,0 +1,24 @@ +{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%} + {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }} +{% endmacro %} + +{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%} + {%- do dbt_utils._is_relation(from, 'star') -%} + {%- do dbt_utils._is_ephemeral(from, 'star') -%} + + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} + {%- if not execute -%} + {{ return('*') }} + {% endif %} + + {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %} + + {%- if cols|length <= 0 -%} + {{- return('*') -}} + {%- else -%} + {%- for col in cols %} + {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%} + {%- if not loop.last %},{{ '\n ' }}{% endif %} + {%- endfor -%} + {% endif %} +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/sql/surrogate_key.sql b/dbt_packages/dbt_utils/macros/sql/surrogate_key.sql new file mode 100644 index 0000000..ba5c3e4 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/surrogate_key.sql @@ -0,0 +1,51 @@ +{%- macro surrogate_key(field_list) -%} + {# needed for safe_add to allow for non-keyword arguments see SO post #} + {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #} + {% set frustrating_jinja_feature = varargs %} + {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }} +{% endmacro %} + +{%- macro default__surrogate_key(field_list) -%} + +{%- if varargs|length >= 1 or field_list is string %} + +{%- set error_message = ' +Warning: the `surrogate_key` macro now takes a single list argument instead of \ +multiple string arguments. Support for multiple string arguments will be \ +deprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \ +'.format(model.package_name, model.name) -%} + +{%- do exceptions.warn(error_message) -%} + +{# first argument is not included in varargs, so add first element to field_list_xf #} +{%- set field_list_xf = [field_list] -%} + +{%- for field in varargs %} +{%- set _ = field_list_xf.append(field) -%} +{%- endfor -%} + +{%- else -%} + +{# if using list, just set field_list_xf as field_list #} +{%- set field_list_xf = field_list -%} + +{%- endif -%} + + +{%- set fields = [] -%} + +{%- for field in field_list_xf -%} + + {%- set _ = fields.append( + "coalesce(cast(" ~ field ~ " as " ~ dbt_utils.type_string() ~ "), '')" + ) -%} + + {%- if not loop.last %} + {%- set _ = fields.append("'-'") -%} + {%- endif -%} + +{%- endfor -%} + +{{dbt_utils.hash(dbt_utils.concat(fields))}} + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/sql/union.sql b/dbt_packages/dbt_utils/macros/sql/union.sql new file mode 100644 index 0000000..cb96048 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/union.sql @@ -0,0 +1,111 @@ +{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%} + {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }} +{% endmacro %} + +{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%} + + {%- if exclude and include -%} + {{ exceptions.raise_compiler_error("Both an exclude and include list were provided to the `union` macro. Only one is allowed") }} + {%- endif -%} + + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#} + {%- if not execute %} + {{ return('') }} + {% endif -%} + + {%- set column_override = column_override if column_override is not none else {} -%} + + {%- set relation_columns = {} -%} + {%- set column_superset = {} -%} + + {%- for relation in relations -%} + + {%- do relation_columns.update({relation: []}) -%} + + {%- do dbt_utils._is_relation(relation, 'union_relations') -%} + {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%} + {%- set cols = adapter.get_columns_in_relation(relation) -%} + {%- for col in cols -%} + + {#- If an exclude list was provided and the column is in the list, do nothing -#} + {%- if exclude and col.column in exclude -%} + + {#- If an include list was provided and the column is not in the list, do nothing -#} + {%- elif include and col.column not in include -%} + + {#- Otherwise add the column to the column superset -#} + {%- else -%} + + {#- update the list of columns in this relation -#} + {%- do relation_columns[relation].append(col.column) -%} + + {%- if col.column in column_superset -%} + + {%- set stored = column_superset[col.column] -%} + {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%} + + {%- do column_superset.update({col.column: col}) -%} + + {%- endif %} + + {%- else -%} + + {%- do column_superset.update({col.column: col}) -%} + + {%- endif -%} + + {%- endif -%} + + {%- endfor -%} + {%- endfor -%} + + {%- set ordered_column_names = column_superset.keys() -%} + {%- set dbt_command = flags.WHICH -%} + + + {% if dbt_command in ['run', 'build'] %} + {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %} + {%- set relations_string -%} + {%- for relation in relations -%} + {{ relation.name }} + {%- if not loop.last %}, {% endif -%} + {%- endfor -%} + {%- endset -%} + + {%- set error_message -%} + There were no columns found to union for relations {{ relations_string }} + {%- endset -%} + + {{ exceptions.raise_compiler_error(error_message) }} + {%- endif -%} + {%- endif -%} + + {%- for relation in relations %} + + ( + select + + cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }}, + {% for col_name in ordered_column_names -%} + + {%- set col = column_superset[col_name] %} + {%- set col_type = column_override.get(col.column, col.data_type) %} + {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %} + cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%} + + {%- endfor %} + + from {{ relation }} + + {% if where -%} + where {{ where }} + {%- endif %} + ) + + {% if not loop.last -%} + union all + {% endif -%} + + {%- endfor -%} + +{%- endmacro -%} diff --git a/dbt_packages/dbt_utils/macros/sql/unpivot.sql b/dbt_packages/dbt_utils/macros/sql/unpivot.sql new file mode 100644 index 0000000..8821aad --- /dev/null +++ b/dbt_packages/dbt_utils/macros/sql/unpivot.sql @@ -0,0 +1,79 @@ +{# +Pivot values from columns to rows. Similar to pandas DataFrame melt() function. + +Example Usage: {{ unpivot(relation=ref('users'), cast_to='integer', exclude=['id','created_at']) }} + +Arguments: + relation: Relation object, required. + cast_to: The datatype to cast all unpivoted columns to. Default is varchar. + exclude: A list of columns to keep but exclude from the unpivot operation. Default is none. + remove: A list of columns to remove from the resulting table. Default is none. + field_name: Destination table column name for the source table column names. + value_name: Destination table column name for the pivoted values +#} + +{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%} + {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }} +{% endmacro %} + +{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%} + + {% if table %} + {%- set error_message = ' + Warning: the `unpivot` macro no longer accepts a `table` parameter. \ + This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \ + The {}.{} model triggered this warning. \ + '.format(model.package_name, model.name) -%} + {%- do exceptions.warn(error_message) -%} + {% endif %} + + {% if relation and table %} + {{ exceptions.raise_compiler_error("Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).") }} + {% elif not relation and table %} + {% set relation=table %} + {% elif not relation and not table %} + {{ exceptions.raise_compiler_error("Error: argument `relation` is required for `unpivot` macro.") }} + {% endif %} + + {%- set exclude = exclude if exclude is not none else [] %} + {%- set remove = remove if remove is not none else [] %} + + {%- set include_cols = [] %} + + {%- set table_columns = {} %} + + {%- do table_columns.update({relation: []}) %} + + {%- do dbt_utils._is_relation(relation, 'unpivot') -%} + {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%} + {%- set cols = adapter.get_columns_in_relation(relation) %} + + {%- for col in cols -%} + {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%} + {% do include_cols.append(col) %} + {%- endif %} + {%- endfor %} + + + {%- for col in include_cols -%} + select + {%- for exclude_col in exclude %} + {{ exclude_col }}, + {%- endfor %} + + cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }}, + cast( {% if col.data_type == 'boolean' %} + {{ dbt_utils.cast_bool_to_text(col.column) }} + {% else %} + {{ col.column }} + {% endif %} + as {{ cast_to }}) as {{ value_name }} + + from {{ relation }} + + {% if not loop.last -%} + union all + {% endif -%} + {%- endfor -%} + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/web/get_url_host.sql b/dbt_packages/dbt_utils/macros/web/get_url_host.sql new file mode 100644 index 0000000..43a58cc --- /dev/null +++ b/dbt_packages/dbt_utils/macros/web/get_url_host.sql @@ -0,0 +1,27 @@ +{% macro get_url_host(field) -%} + {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }} +{% endmacro %} + +{% macro default__get_url_host(field) -%} + +{%- set parsed = + dbt_utils.split_part( + dbt_utils.split_part( + dbt_utils.replace( + dbt_utils.replace( + dbt_utils.replace(field, "'android-app://'", "''" + ), "'http://'", "''" + ), "'https://'", "''" + ), "'/'", 1 + ), "'?'", 1 + ) + +-%} + + + {{ dbt_utils.safe_cast( + parsed, + dbt_utils.type_string() + )}} + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/web/get_url_parameter.sql b/dbt_packages/dbt_utils/macros/web/get_url_parameter.sql new file mode 100644 index 0000000..f363fcb --- /dev/null +++ b/dbt_packages/dbt_utils/macros/web/get_url_parameter.sql @@ -0,0 +1,13 @@ +{% macro get_url_parameter(field, url_parameter) -%} + {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }} +{% endmacro %} + +{% macro default__get_url_parameter(field, url_parameter) -%} + +{%- set formatted_url_parameter = "'" + url_parameter + "='" -%} + +{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), "'&'", 1) -%} + +nullif({{ split }},'') + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/macros/web/get_url_path.sql b/dbt_packages/dbt_utils/macros/web/get_url_path.sql new file mode 100644 index 0000000..4d22427 --- /dev/null +++ b/dbt_packages/dbt_utils/macros/web/get_url_path.sql @@ -0,0 +1,34 @@ +{% macro get_url_path(field) -%} + {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }} +{% endmacro %} + +{% macro default__get_url_path(field) -%} + + {%- set stripped_url = + dbt_utils.replace( + dbt_utils.replace(field, "'http://'", "''"), "'https://'", "''") + -%} + + {%- set first_slash_pos -%} + coalesce( + nullif({{dbt_utils.position("'/'", stripped_url)}}, 0), + {{dbt_utils.position("'?'", stripped_url)}} - 1 + ) + {%- endset -%} + + {%- set parsed_path = + dbt_utils.split_part( + dbt_utils.right( + stripped_url, + dbt_utils.length(stripped_url) ~ "-" ~ first_slash_pos + ), + "'?'", 1 + ) + -%} + + {{ dbt_utils.safe_cast( + parsed_path, + dbt_utils.type_string() + )}} + +{%- endmacro %} diff --git a/dbt_packages/dbt_utils/pytest.ini b/dbt_packages/dbt_utils/pytest.ini new file mode 100644 index 0000000..a81f2a6 --- /dev/null +++ b/dbt_packages/dbt_utils/pytest.ini @@ -0,0 +1,8 @@ +[pytest] +filterwarnings = + ignore:.*'soft_unicode' has been renamed to 'soft_str'*:DeprecationWarning + ignore:unclosed file .*:ResourceWarning +env_files = + test.env +testpaths = + tests/functional \ No newline at end of file diff --git a/dbt_packages/dbt_utils/run_functional_test.sh b/dbt_packages/dbt_utils/run_functional_test.sh new file mode 100644 index 0000000..4f8d068 --- /dev/null +++ b/dbt_packages/dbt_utils/run_functional_test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -m pytest tests/functional --profile $1 diff --git a/dbt_packages/dbt_utils/run_test.sh b/dbt_packages/dbt_utils/run_test.sh new file mode 100644 index 0000000..7f2663e --- /dev/null +++ b/dbt_packages/dbt_utils/run_test.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Show location of local install of dbt +echo $(which dbt) + +# Show version and installed adapters +dbt --version + +# Set the profile +cd integration_tests +cp ci/sample.profiles.yml profiles.yml +export DBT_PROFILES_DIR=. + +# Show the location of the profiles directory and test the connection +dbt debug --target $1 + +_models="" +_seeds="--full-refresh" +if [[ ! -z $2 ]]; then _models="--models $2"; fi +if [[ ! -z $3 ]]; then _seeds="--select $3 --full-refresh"; fi + +dbt deps --target $1 || exit 1 +dbt seed --target $1 $_seeds || exit 1 +if [ $1 == 'redshift' ]; then + dbt run -x -m test_insert_by_period --full-refresh --target redshift || exit 1 +fi +dbt run -x --target $1 $_models || exit 1 +dbt test -x --target $1 $_models || exit 1 diff --git a/dbt_packages/dbt_utils/tests/__init__.py b/dbt_packages/dbt_utils/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dbt_packages/dbt_utils/tests/conftest.py b/dbt_packages/dbt_utils/tests/conftest.py new file mode 100644 index 0000000..4858b21 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/conftest.py @@ -0,0 +1,98 @@ +import pytest +import os + +pytest_plugins = ["dbt.tests.fixtures.project"] + + +def pytest_addoption(parser): + parser.addoption("--profile", action="store", default="apache_spark", type=str) + + +# Using @pytest.mark.skip_adapter('apache_spark') uses the 'skip_by_adapter_type' +# autouse fixture below +def pytest_configure(config): + config.addinivalue_line( + "markers", + "skip_profile(profile): skip test for the given profile", + ) + config.addinivalue_line( + "markers", + "only_profile(profile): only test the given profile", + ) + + +@pytest.fixture(scope="session") +def dbt_profile_target(request): + profile_type = request.config.getoption("--profile") + if profile_type == "postgres": + target = postgres_target() + elif profile_type == "redshift": + target = redshift_target() + elif profile_type == "snowflake": + target = snowflake_target() + elif profile_type == "bigquery": + target = bigquery_target() + else: + raise ValueError(f"Invalid profile type '{profile_type}'") + return target + + +def postgres_target(): + return { + "type": "postgres", + "host": os.getenv('POSTGRES_TEST_HOST'), + "user": os.getenv('POSTGRES_TEST_USER'), + "pass": os.getenv('POSTGRES_TEST_PASS'), + "port": int(os.getenv('POSTGRES_TEST_PORT')), + "dbname": os.getenv('POSTGRES_TEST_DBNAME'), + } + + +def redshift_target(): + return { + "type": "redshift", + "host": os.getenv('REDSHIFT_TEST_HOST'), + "user": os.getenv('REDSHIFT_TEST_USER'), + "pass": os.getenv('REDSHIFT_TEST_PASS'), + "port": int(os.getenv('REDSHIFT_TEST_PORT')), + "dbname": os.getenv('REDSHIFT_TEST_DBNAME'), + } + + +def bigquery_target(): + return { + "type": "bigquery", + "method": "service-account", + "keyfile": os.getenv('BIGQUERY_SERVICE_KEY_PATH'), + "project": os.getenv('BIGQUERY_TEST_DATABASE'), + } + + +def snowflake_target(): + return { + "type": "snowflake", + "account": os.getenv('SNOWFLAKE_TEST_ACCOUNT'), + "user": os.getenv('SNOWFLAKE_TEST_USER'), + "password": os.getenv('SNOWFLAKE_TEST_PASSWORD'), + "role": os.getenv('SNOWFLAKE_TEST_ROLE'), + "database": os.getenv('SNOWFLAKE_TEST_DATABASE'), + "warehouse": os.getenv('SNOWFLAKE_TEST_WAREHOUSE'), + } + + +@pytest.fixture(autouse=True) +def skip_by_profile_type(request): + profile_type = request.config.getoption("--profile") + if request.node.get_closest_marker("skip_profile"): + for skip_profile_type in request.node.get_closest_marker("skip_profile").args: + if skip_profile_type == profile_type: + pytest.skip("skipped on '{profile_type}' profile") + + +@pytest.fixture(autouse=True) +def only_profile_type(request): + profile_type = request.config.getoption("--profile") + if request.node.get_closest_marker("only_profile"): + for only_profile_type in request.node.get_closest_marker("only_profile").args: + if only_profile_type != profile_type: + pytest.skip("skipped on '{profile_type}' profile") diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/base_cross_db_macro.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/base_cross_db_macro.py new file mode 100644 index 0000000..a504aaf --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/base_cross_db_macro.py @@ -0,0 +1,30 @@ +import os +import pytest +from dbt.tests.util import run_dbt +from tests.functional.cross_db_utils.fixture_cross_db_macro import ( + macros__test_assert_equal_sql, +) + + +class BaseCrossDbMacro: + # install this repo as a package! + @pytest.fixture(scope="class") + def packages(self): + return {"packages": [{"local": os.getcwd()}]} + + # setup + @pytest.fixture(scope="class") + def macros(self): + return {"test_assert_equal.sql": macros__test_assert_equal_sql} + + # each child class will reimplement 'models' + 'seeds' + def seeds(self): + return {} + + def models(self): + return {} + + # actual test sequence + def test_build_assert_equal(self, project): + run_dbt(['deps']) + run_dbt(['build']) # seed, model, test -- all handled by dbt diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_any_value.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_any_value.py new file mode 100644 index 0000000..81ac11d --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_any_value.py @@ -0,0 +1,61 @@ + +# any_value + +seeds__data_any_value_csv = """id,key_name,static_col +1,abc,dbt +2,abc,dbt +3,jkl,dbt +4,jkl,dbt +5,jkl,dbt +6,xyz,test +""" + + +seeds__data_any_value_expected_csv = """key_name,static_col,num_rows +abc,dbt,2 +jkl,dbt,3 +xyz,test,1 +""" + + +models__test_any_value_sql = """ +with data as ( + + select * from {{ ref('data_any_value') }} + +), + +data_output as ( + + select * from {{ ref('data_any_value_expected') }} + +), + +calculate as ( + select + key_name, + {{ dbt_utils.any_value('static_col') }} as static_col, + count(id) as num_rows + from data + group by key_name +) + +select + calculate.num_rows as actual, + data_output.num_rows as expected +from calculate +left join data_output +on calculate.key_name = data_output.key_name +and calculate.static_col = data_output.static_col +""" + + +models__test_any_value_yml = """ +version: 2 +models: + - name: test_any_value + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_bool_or.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_bool_or.py new file mode 100644 index 0000000..ca76a54 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_bool_or.py @@ -0,0 +1,63 @@ + +# bool_or + +seeds__data_bool_or_csv = """key,val1,val2 +abc,1,1 +abc,1,0 +def,1,0 +hij,1,1 +hij,1, +klm,1,0 +klm,1, +""" + + +seeds__data_bool_or_expected_csv = """key,value +abc,true +def,false +hij,true +klm,false +""" + + +models__test_bool_or_sql = """ +with data as ( + + select * from {{ ref('data_bool_or') }} + +), + +data_output as ( + + select * from {{ ref('data_bool_or_expected') }} + +), + +calculate as ( + + select + key, + {{ dbt_utils.bool_or('val1 = val2') }} as value + from data + group by key + +) + +select + calculate.value as actual, + data_output.value as expected +from calculate +left join data_output +on calculate.key = data_output.key +""" + + +models__test_bool_or_yml = """ +version: 2 +models: + - name: test_bool_or + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cast_bool_to_text.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cast_bool_to_text.py new file mode 100644 index 0000000..acdf13e --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cast_bool_to_text.py @@ -0,0 +1,30 @@ + +# cast_bool_to_text + +models__test_cast_bool_to_text_sql = """ +with data as ( + + select 0=1 as input, 'false' as expected union all + select 1=1 as input, 'true' as expected union all + select null as input, null as expected + +) + +select + + {{ dbt_utils.cast_bool_to_text("input") }} as actual, + expected + +from data +""" + + +models__test_cast_bool_to_text_yml = """ +version: 2 +models: + - name: test_cast_bool_to_text + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_concat.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_concat.py new file mode 100644 index 0000000..778d8bd --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_concat.py @@ -0,0 +1,36 @@ + + +# concat + +seeds__data_concat_csv = """input_1,input_2,output +a,b,ab +a,,a +,b,b +,, +""" + + +models__test_concat_sql = """ +with data as ( + + select * from {{ ref('data_concat') }} + +) + +select + {{ dbt_utils.concat(['input_1', 'input_2']) }} as actual, + output as expected + +from data +""" + + +models__test_concat_yml = """ +version: 2 +models: + - name: test_concat + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cross_db_macro.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cross_db_macro.py new file mode 100644 index 0000000..76fdb0f --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_cross_db_macro.py @@ -0,0 +1,6 @@ +macros__test_assert_equal_sql = """ +{% test assert_equal(model, actual, expected) %} +select * from {{ model }} where {{ actual }} != {{ expected }} + +{% endtest %} +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp.py new file mode 100644 index 0000000..dcd38aa --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp.py @@ -0,0 +1,20 @@ + +# current_timestamp + +# TODO how can we test this better? +models__test_current_timestamp_sql = """ +select + {{ dbt_utils.current_timestamp() }} as actual, + {{ dbt_utils.current_timestamp() }} as expected +""" + + +models__test_current_timestamp_yml = """ +version: 2 +models: + - name: test_current_timestamp + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp_in_utc.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp_in_utc.py new file mode 100644 index 0000000..61caef3 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_current_timestamp_in_utc.py @@ -0,0 +1,20 @@ + +# current_timestamp_in_utc + +# TODO how can we test this better? +models__test_current_timestamp_in_utc_sql = """ +select + {{ dbt_utils.current_timestamp_in_utc() }} as actual, + {{ dbt_utils.current_timestamp_in_utc() }} as expected +""" + + +models__test_current_timestamp_in_utc_yml = """ +version: 2 +models: + - name: test_current_timestamp_in_utc + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_date_trunc.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_date_trunc.py new file mode 100644 index 0000000..91eb5c2 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_date_trunc.py @@ -0,0 +1,41 @@ + +# date_trunc + +seeds__data_date_trunc_csv = """updated_at,day,month +2018-01-05 12:00:00,2018-01-05,2018-01-01 +,, +""" + + +models__test_date_trunc_sql = """ +with data as ( + + select * from {{ ref('data_date_trunc') }} + +) + +select + cast({{dbt_utils.date_trunc('day', 'updated_at') }} as date) as actual, + day as expected + +from data + +union all + +select + cast({{ dbt_utils.date_trunc('month', 'updated_at') }} as date) as actual, + month as expected + +from data +""" + + +models__test_date_trunc_yml = """ +version: 2 +models: + - name: test_date_trunc + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_dateadd.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_dateadd.py new file mode 100644 index 0000000..95d8cce --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_dateadd.py @@ -0,0 +1,41 @@ + +# dateadd + +seeds__data_dateadd_csv = """from_time,interval_length,datepart,result +2018-01-01 01:00:00,1,day,2018-01-02 01:00:00 +2018-01-01 01:00:00,1,month,2018-02-01 01:00:00 +2018-01-01 01:00:00,1,year,2019-01-01 01:00:00 +2018-01-01 01:00:00,1,hour,2018-01-01 02:00:00 +,1,day, +""" + + +models__test_dateadd_sql = """ +with data as ( + + select * from {{ ref('data_dateadd') }} + +) + +select + case + when datepart = 'hour' then cast({{ dbt_utils.dateadd('hour', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'day' then cast({{ dbt_utils.dateadd('day', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'month' then cast({{ dbt_utils.dateadd('month', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + when datepart = 'year' then cast({{ dbt_utils.dateadd('year', 'interval_length', 'from_time') }} as {{dbt_utils.type_timestamp()}}) + else null + end as actual, + result as expected + +from data +""" + +models__test_dateadd_yml = """ +version: 2 +models: + - name: test_dateadd + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_datediff.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_datediff.py new file mode 100644 index 0000000..0ac216a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_datediff.py @@ -0,0 +1,66 @@ + +# datediff + +seeds__data_datediff_csv = """first_date,second_date,datepart,result +2018-01-01 01:00:00,2018-01-02 01:00:00,day,1 +2018-01-01 01:00:00,2018-02-01 01:00:00,month,1 +2018-01-01 01:00:00,2019-01-01 01:00:00,year,1 +2018-01-01 01:00:00,2018-01-01 02:00:00,hour,1 +2018-01-01 01:00:00,2018-01-01 02:01:00,minute,61 +2018-01-01 01:00:00,2018-01-01 02:00:01,second,3601 +2019-12-31 00:00:00,2019-12-27 00:00:00,week,-1 +2019-12-31 00:00:00,2019-12-30 00:00:00,week,0 +2019-12-31 00:00:00,2020-01-02 00:00:00,week,0 +2019-12-31 00:00:00,2020-01-06 02:00:00,week,1 +,2018-01-01 02:00:00,hour, +2018-01-01 02:00:00,,hour, +""" + + +models__test_datediff_sql = """ +with data as ( + + select * from {{ ref('data_datediff') }} + +) + +select + + case + when datepart = 'second' then {{ dbt_utils.datediff('first_date', 'second_date', 'second') }} + when datepart = 'minute' then {{ dbt_utils.datediff('first_date', 'second_date', 'minute') }} + when datepart = 'hour' then {{ dbt_utils.datediff('first_date', 'second_date', 'hour') }} + when datepart = 'day' then {{ dbt_utils.datediff('first_date', 'second_date', 'day') }} + when datepart = 'week' then {{ dbt_utils.datediff('first_date', 'second_date', 'week') }} + when datepart = 'month' then {{ dbt_utils.datediff('first_date', 'second_date', 'month') }} + when datepart = 'year' then {{ dbt_utils.datediff('first_date', 'second_date', 'year') }} + else null + end as actual, + result as expected + +from data + +-- Also test correct casting of literal values. + +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "microsecond") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "millisecond") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "second") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "minute") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "hour") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "day") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-03 00:00:00.000000'", "week") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "month") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "quarter") }} as actual, 1 as expected +union all select {{ dbt_utils.datediff("'1999-12-31 23:59:59.999999'", "'2000-01-01 00:00:00.000000'", "year") }} as actual, 1 as expected +""" + + +models__test_datediff_yml = """ +version: 2 +models: + - name: test_datediff + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_escape_single_quotes.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_escape_single_quotes.py new file mode 100644 index 0000000..3264d05 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_escape_single_quotes.py @@ -0,0 +1,25 @@ + +# escape_single_quotes + +models__test_escape_single_quotes_quote_sql = """ +select '{{ dbt_utils.escape_single_quotes("they're") }}' as actual, 'they''re' as expected union all +select '{{ dbt_utils.escape_single_quotes("they are") }}' as actual, 'they are' as expected +""" + + +# The expected literal is 'they\'re'. The second backslash is to escape it from Python. +models__test_escape_single_quotes_backslash_sql = """ +select '{{ dbt_utils.escape_single_quotes("they're") }}' as actual, 'they\\'re' as expected union all +select '{{ dbt_utils.escape_single_quotes("they are") }}' as actual, 'they are' as expected +""" + + +models__test_escape_single_quotes_yml = """ +version: 2 +models: + - name: test_escape_single_quotes + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_except.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_except.py new file mode 100644 index 0000000..013b794 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_except.py @@ -0,0 +1,65 @@ + +# except + +seeds__data_except_a_csv = """id +1 +2 +3 +""" + +seeds__data_except_b_csv = """id +3 +4 +5 +""" + +seeds__data_except_a_minus_b_csv = """id +1 +2 +""" + +seeds__data_except_b_minus_a_csv = """id +4 +5 +""" + +models__data_except_empty_sql = """ +select * from {{ ref('data_except_a') }} +where 0=1 +""" + +models__test_except_a_minus_b_sql = """ +select * from {{ ref('data_except_a') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_b') }} +""" + +models__test_except_b_minus_a_sql = """ +select * from {{ ref('data_except_b') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_a') }} +""" + +models__test_except_a_minus_a_sql = """ +select * from {{ ref('data_except_a') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_a') }} +""" + +models__test_except_a_minus_empty_sql = """ +select * from {{ ref('data_except_a') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_empty') }} +""" + +models__test_except_empty_minus_a_sql = """ +select * from {{ ref('data_except_empty') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_a') }} +""" + +models__test_except_empty_minus_empty_sql = """ +select * from {{ ref('data_except_empty') }} +{{ dbt_utils.except() }} +select * from {{ ref('data_except_empty') }} +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_hash.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_hash.py new file mode 100644 index 0000000..1f0b554 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_hash.py @@ -0,0 +1,35 @@ + +# hash + +seeds__data_hash_csv = """input_1,output +ab,187ef4436122d1cc2f40dc2b92f0eba0 +a,0cc175b9c0f1b6a831c399e269772661 +1,c4ca4238a0b923820dcc509a6f75849b +,d41d8cd98f00b204e9800998ecf8427e +""" + + +models__test_hash_sql = """ +with data as ( + + select * from {{ ref('data_hash') }} + +) + +select + {{ dbt_utils.hash('input_1') }} as actual, + output as expected + +from data +""" + + +models__test_hash_yml = """ +version: 2 +models: + - name: test_hash + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_intersect.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_intersect.py new file mode 100644 index 0000000..934d93a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_intersect.py @@ -0,0 +1,59 @@ + +# intersect + +seeds__data_intersect_a_csv = """id +1 +2 +3 +""" + +seeds__data_intersect_b_csv = """id +3 +4 +5 +""" + +seeds__data_intersect_a_overlap_b_csv = """id +3 +""" + +models__data_intersect_empty_sql = """ +select * from {{ ref('data_intersect_a') }} +where 0=1 +""" + +models__test_intersect_a_overlap_b_sql = """ +select * from {{ ref('data_intersect_a') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_b') }} +""" + +models__test_intersect_b_overlap_a_sql = """ +select * from {{ ref('data_intersect_b') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_a') }} +""" + +models__test_intersect_a_overlap_a_sql = """ +select * from {{ ref('data_intersect_a') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_a') }} +""" + +models__test_intersect_a_overlap_empty_sql = """ +select * from {{ ref('data_intersect_a') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_empty') }} +""" + +models__test_intersect_empty_overlap_a_sql = """ +select * from {{ ref('data_intersect_empty') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_a') }} +""" + +models__test_intersect_empty_overlap_empty_sql = """ +select * from {{ ref('data_intersect_empty') }} +{{ dbt_utils.intersect() }} +select * from {{ ref('data_intersect_empty') }} +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_last_day.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_last_day.py new file mode 100644 index 0000000..72fbd35 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_last_day.py @@ -0,0 +1,40 @@ + +# last_day + +seeds__data_last_day_csv = """date_day,date_part,result +2018-01-02,month,2018-01-31 +2018-01-02,quarter,2018-03-31 +2018-01-02,year,2018-12-31 +,month, +""" + + +models__test_last_day_sql = """ +with data as ( + + select * from {{ ref('data_last_day') }} + +) + +select + case + when date_part = 'month' then {{ dbt_utils.last_day('date_day', 'month') }} + when date_part = 'quarter' then {{ dbt_utils.last_day('date_day', 'quarter') }} + when date_part = 'year' then {{ dbt_utils.last_day('date_day', 'year') }} + else null + end as actual, + result as expected + +from data +""" + + +models__test_last_day_yml = """ +version: 2 +models: + - name: test_last_day + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_length.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_length.py new file mode 100644 index 0000000..e626474 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_length.py @@ -0,0 +1,36 @@ + +# length + +seeds__data_length_csv = """expression,output +abcdef,6 +fishtown,8 +december,8 +www.google.com/path,19 +""" + + +models__test_length_sql = """ +with data as ( + + select * from {{ ref('data_length') }} + +) + +select + + {{ dbt_utils.length('expression') }} as actual, + output as expected + +from data +""" + + +models__test_length_yml = """ +version: 2 +models: + - name: test_length + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_listagg.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_listagg.py new file mode 100644 index 0000000..9a2380d --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_listagg.py @@ -0,0 +1,111 @@ + +# listagg + +seeds__data_listagg_csv = """group_col,string_text,order_col +1,a,1 +1,b,2 +1,c,3 +2,a,2 +2,1,1 +2,p,3 +3,g,1 +3,g,2 +3,g,3 +""" + + +seeds__data_listagg_output_csv = """group_col,expected,version +1,"a_|_b_|_c",bottom_ordered +2,"1_|_a_|_p",bottom_ordered +3,"g_|_g_|_g",bottom_ordered +1,"a_|_b",bottom_ordered_limited +2,"1_|_a",bottom_ordered_limited +3,"g_|_g",bottom_ordered_limited +3,"g, g, g",comma_whitespace_unordered +3,"g",distinct_comma +3,"g,g,g",no_params +""" + + +models__test_listagg_sql = """ +with data as ( + + select * from {{ ref('data_listagg') }} + +), + +data_output as ( + + select * from {{ ref('data_listagg_output') }} + +), + +calculate as ( + + select + group_col, + {{ dbt_utils.listagg('string_text', "'_|_'", "order by order_col") }} as actual, + 'bottom_ordered' as version + from data + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text', "'_|_'", "order by order_col", 2) }} as actual, + 'bottom_ordered_limited' as version + from data + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text', "', '") }} as actual, + 'comma_whitespace_unordered' as version + from data + where group_col = 3 + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('DISTINCT string_text', "','") }} as actual, + 'distinct_comma' as version + from data + where group_col = 3 + group by group_col + + union all + + select + group_col, + {{ dbt_utils.listagg('string_text') }} as actual, + 'no_params' as version + from data + where group_col = 3 + group by group_col + +) + +select + calculate.actual, + data_output.expected +from calculate +left join data_output +on calculate.group_col = data_output.group_col +and calculate.version = data_output.version +""" + + +models__test_listagg_yml = """ +version: 2 +models: + - name: test_listagg + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_position.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_position.py new file mode 100644 index 0000000..9f66c6a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_position.py @@ -0,0 +1,36 @@ + +# position + +seeds__data_position_csv = """substring_text,string_text,result +def,abcdef,4 +land,earth,0 +town,fishtown,5 +ember,december,4 +""" + + +models__test_position_sql = """ +with data as ( + + select * from {{ ref('data_position') }} + +) + +select + + {{ dbt_utils.position('substring_text', 'string_text') }} as actual, + result as expected + +from data +""" + + +models__test_position_yml = """ +version: 2 +models: + - name: test_position + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_replace.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_replace.py new file mode 100644 index 0000000..c956501 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_replace.py @@ -0,0 +1,40 @@ + +# replace + +seeds__data_replace_csv = """string_text,search_chars,replace_chars,result +a,a,b,b +http://google.com,http://,"",google.com +""" + + +models__test_replace_sql = """ +with data as ( + + select + + *, + coalesce(search_chars, '') as old_chars, + coalesce(replace_chars, '') as new_chars + + from {{ ref('data_replace') }} + +) + +select + + {{ dbt_utils.replace('string_text', 'old_chars', 'new_chars') }} as actual, + result as expected + +from data +""" + + +models__test_replace_yml = """ +version: 2 +models: + - name: test_replace + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_right.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_right.py new file mode 100644 index 0000000..face6ca --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_right.py @@ -0,0 +1,36 @@ + +# right + +seeds__data_right_csv = """string_text,length_expression,output +abcdef,3,def +fishtown,4,town +december,5,ember +december,0, +""" + + +models__test_right_sql = """ +with data as ( + + select * from {{ ref('data_right') }} + +) + +select + + {{ dbt_utils.right('string_text', 'length_expression') }} as actual, + coalesce(output, '') as expected + +from data +""" + + +models__test_right_yml = """ +version: 2 +models: + - name: test_right + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_safe_cast.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_safe_cast.py new file mode 100644 index 0000000..918d3bb --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_safe_cast.py @@ -0,0 +1,34 @@ + +# safe_cast + +seeds__data_safe_cast_csv = """field,output +abc,abc +123,123 +, +""" + + +models__test_safe_cast_sql = """ +with data as ( + + select * from {{ ref('data_safe_cast') }} + +) + +select + {{ dbt_utils.safe_cast('field', dbt_utils.type_string()) }} as actual, + output as expected + +from data +""" + + +models__test_safe_cast_yml = """ +version: 2 +models: + - name: test_safe_cast + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_split_part.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_split_part.py new file mode 100644 index 0000000..ba65a2a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_split_part.py @@ -0,0 +1,50 @@ + +# split_part + +seeds__data_split_part_csv = """parts,split_on,result_1,result_2,result_3 +a|b|c,|,a,b,c +1|2|3,|,1,2,3 +,|,,, +""" + + +models__test_split_part_sql = """ +with data as ( + + select * from {{ ref('data_split_part') }} + +) + +select + {{ dbt_utils.split_part('parts', 'split_on', 1) }} as actual, + result_1 as expected + +from data + +union all + +select + {{ dbt_utils.split_part('parts', 'split_on', 2) }} as actual, + result_2 as expected + +from data + +union all + +select + {{ dbt_utils.split_part('parts', 'split_on', 3) }} as actual, + result_3 as expected + +from data +""" + + +models__test_split_part_yml = """ +version: 2 +models: + - name: test_split_part + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_string_literal.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_string_literal.py new file mode 100644 index 0000000..188208a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_string_literal.py @@ -0,0 +1,20 @@ + +# string_literal + +models__test_string_literal_sql = """ +select {{ dbt_utils.string_literal("abc") }} as actual, 'abc' as expected union all +select {{ dbt_utils.string_literal("1") }} as actual, '1' as expected union all +select {{ dbt_utils.string_literal("") }} as actual, '' as expected union all +select {{ dbt_utils.string_literal(none) }} as actual, 'None' as expected +""" + + +models__test_string_literal_yml = """ +version: 2 +models: + - name: test_string_literal + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_bigint.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_bigint.py new file mode 100644 index 0000000..c1f3ba9 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_bigint.py @@ -0,0 +1,36 @@ + + +# type_bigint + +# TODO - implement expected results here +seeds__data_type_bigint_csv = """todo,result +TODO,1 +""" + + +models__test_type_bigint_sql = """ +with data as ( + + select * from {{ ref('data_type_bigint') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_bigint_yml = """ +version: 2 +models: + - name: test_type_bigint + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_boolean.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_boolean.py new file mode 100644 index 0000000..fbde496 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_boolean.py @@ -0,0 +1,36 @@ + + +# type_boolean + +# TODO - implement expected results here +seeds__data_type_boolean_csv = """todo,result +TODO,1 +""" + + +models__test_type_boolean_sql = """ +with data as ( + + select * from {{ ref('data_type_boolean') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_boolean_yml = """ +version: 2 +models: + - name: test_type_boolean + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_float.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_float.py new file mode 100644 index 0000000..9333f63 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_float.py @@ -0,0 +1,36 @@ + + +# type_float + +# TODO - implement expected results here +seeds__data_type_float_csv = """todo,result +TODO,1 +""" + + +models__test_type_float_sql = """ +with data as ( + + select * from {{ ref('data_type_float') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_float_yml = """ +version: 2 +models: + - name: test_type_float + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_int.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_int.py new file mode 100644 index 0000000..982a401 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_int.py @@ -0,0 +1,36 @@ + + +# type_int + +# TODO - implement expected results here +seeds__data_type_int_csv = """todo,result +TODO,1 +""" + + +models__test_type_int_sql = """ +with data as ( + + select * from {{ ref('data_type_int') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_int_yml = """ +version: 2 +models: + - name: test_type_int + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_numeric.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_numeric.py new file mode 100644 index 0000000..a4929cb --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_numeric.py @@ -0,0 +1,36 @@ + + +# type_numeric + +# TODO - implement expected results here +seeds__data_type_numeric_csv = """todo,result +TODO,1 +""" + + +models__test_type_numeric_sql = """ +with data as ( + + select * from {{ ref('data_type_numeric') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_numeric_yml = """ +version: 2 +models: + - name: test_type_numeric + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_string.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_string.py new file mode 100644 index 0000000..38a0001 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_string.py @@ -0,0 +1,36 @@ + + +# type_string + +# TODO - implement expected results here +seeds__data_type_string_csv = """todo,result +TODO,1 +""" + + +models__test_type_string_sql = """ +with data as ( + + select * from {{ ref('data_type_string') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_string_yml = """ +version: 2 +models: + - name: test_type_string + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_timestamp.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_timestamp.py new file mode 100644 index 0000000..3b28adc --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/fixture_type_timestamp.py @@ -0,0 +1,36 @@ + + +# type_timestamp + +# TODO - implement expected results here +seeds__data_type_timestamp_csv = """todo,result +TODO,1 +""" + + +models__test_type_timestamp_sql = """ +with data as ( + + select * from {{ ref('data_type_timestamp') }} + +) + +-- TODO - implement actual logic here +select + + 1 as actual, + 1 as expected + +from data +""" + + +models__test_type_timestamp_yml = """ +version: 2 +models: + - name: test_type_timestamp + tests: + - assert_equal: + actual: actual + expected: expected +""" diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_any_value.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_any_value.py new file mode 100644 index 0000000..f0a3acd --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_any_value.py @@ -0,0 +1,28 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_any_value import ( + seeds__data_any_value_csv, + seeds__data_any_value_expected_csv, + models__test_any_value_sql, + models__test_any_value_yml, +) + + +class BaseAnyValue(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return { + "data_any_value.csv": seeds__data_any_value_csv, + "data_any_value_expected.csv": seeds__data_any_value_expected_csv, + } + + @pytest.fixture(scope="class") + def models(self): + return { + "test_any_value.yml": models__test_any_value_yml, + "test_any_value.sql": models__test_any_value_sql, + } + + +class TestAnyValue(BaseAnyValue): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_bool_or.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_bool_or.py new file mode 100644 index 0000000..c8c7a56 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_bool_or.py @@ -0,0 +1,28 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_bool_or import ( + seeds__data_bool_or_csv, + seeds__data_bool_or_expected_csv, + models__test_bool_or_sql, + models__test_bool_or_yml, +) + + +class BaseBoolOr(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return { + "data_bool_or.csv": seeds__data_bool_or_csv, + "data_bool_or_expected.csv": seeds__data_bool_or_expected_csv + } + + @pytest.fixture(scope="class") + def models(self): + return { + "test_bool_or.yml": models__test_bool_or_yml, + "test_bool_or.sql": models__test_bool_or_sql, + } + + +class TestBoolOr(BaseBoolOr): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_cast_bool_to_text.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_cast_bool_to_text.py new file mode 100644 index 0000000..0670cc2 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_cast_bool_to_text.py @@ -0,0 +1,19 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_cast_bool_to_text import ( + models__test_cast_bool_to_text_sql, + models__test_cast_bool_to_text_yml, +) + + +class BaseCastBoolToText(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_cast_bool_to_text.yml": models__test_cast_bool_to_text_yml, + "test_cast_bool_to_text.sql": models__test_cast_bool_to_text_sql, + } + + +class TestCastBoolToText(BaseCastBoolToText): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_concat.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_concat.py new file mode 100644 index 0000000..1cee2f2 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_concat.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_concat import ( + seeds__data_concat_csv, + models__test_concat_sql, + models__test_concat_yml, +) + + +class BaseConcat(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_concat.csv": seeds__data_concat_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_concat.yml": models__test_concat_yml, + "test_concat.sql": models__test_concat_sql, + } + + +class TestConcat(BaseConcat): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp.py new file mode 100644 index 0000000..ba1a52d --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp.py @@ -0,0 +1,19 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_current_timestamp import ( + models__test_current_timestamp_sql, + models__test_current_timestamp_yml, +) + + +class BaseCurrentTimestamp(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_current_timestamp.yml": models__test_current_timestamp_yml, + "test_current_timestamp.sql": models__test_current_timestamp_sql, + } + + +class TestCurrentTimestamp(BaseCurrentTimestamp): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp_in_utc.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp_in_utc.py new file mode 100644 index 0000000..adcedc2 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_current_timestamp_in_utc.py @@ -0,0 +1,19 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_current_timestamp_in_utc import ( + models__test_current_timestamp_in_utc_sql, + models__test_current_timestamp_in_utc_yml, +) + + +class BaseCurrentTimestampInUtc(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_current_timestamp_in_utc.yml": models__test_current_timestamp_in_utc_yml, + "test_current_timestamp_in_utc.sql": models__test_current_timestamp_in_utc_sql, + } + + +class TestCurrentTimestampInUtc(BaseCurrentTimestampInUtc): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_date_trunc.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_date_trunc.py new file mode 100644 index 0000000..6722c2c --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_date_trunc.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_date_trunc import ( + seeds__data_date_trunc_csv, + models__test_date_trunc_sql, + models__test_date_trunc_yml, +) + + +class BaseDateTrunc(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_date_trunc.csv": seeds__data_date_trunc_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_date_trunc.yml": models__test_date_trunc_yml, + "test_date_trunc.sql": models__test_date_trunc_sql, + } + + +class TestDateTrunc(BaseDateTrunc): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_dateadd.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_dateadd.py new file mode 100644 index 0000000..ef9e791 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_dateadd.py @@ -0,0 +1,40 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_dateadd import ( + seeds__data_dateadd_csv, + models__test_dateadd_sql, + models__test_dateadd_yml, +) + + +class BaseDateAdd(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "name": "test", + "seeds": { + "test": { + "data_dateadd": { + "+column_types": { + "from_time": "timestamp", + "result": "timestamp", + }, + }, + }, + }, + } + + @pytest.fixture(scope="class") + def seeds(self): + return {"data_dateadd.csv": seeds__data_dateadd_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_dateadd.yml": models__test_dateadd_yml, + "test_dateadd.sql": models__test_dateadd_sql, + } + + +class TestDateAdd(BaseDateAdd): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_datediff.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_datediff.py new file mode 100644 index 0000000..6a58eae --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_datediff.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_datediff import ( + seeds__data_datediff_csv, + models__test_datediff_sql, + models__test_datediff_yml, +) + + +class BaseDateDiff(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_datediff.csv": seeds__data_datediff_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_datediff.yml": models__test_datediff_yml, + "test_datediff.sql": models__test_datediff_sql, + } + + +class TestDateDiff(BaseDateDiff): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_escape_single_quotes.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_escape_single_quotes.py new file mode 100644 index 0000000..1462ee5 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_escape_single_quotes.py @@ -0,0 +1,45 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_escape_single_quotes import ( + models__test_escape_single_quotes_quote_sql, + models__test_escape_single_quotes_backslash_sql, + models__test_escape_single_quotes_yml, +) + + +class BaseEscapeSingleQuotesQuote(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_escape_single_quotes.yml": models__test_escape_single_quotes_yml, + "test_escape_single_quotes.sql": models__test_escape_single_quotes_quote_sql, + } + + +class BaseEscapeSingleQuotesBackslash(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_escape_single_quotes.yml": models__test_escape_single_quotes_yml, + "test_escape_single_quotes.sql": models__test_escape_single_quotes_backslash_sql, + } + + +@pytest.mark.only_profile("postgres") +class TestEscapeSingleQuotesPostgres(BaseEscapeSingleQuotesQuote): + pass + + +@pytest.mark.only_profile("redshift") +class TestEscapeSingleQuotesRedshift(BaseEscapeSingleQuotesQuote): + pass + + +@pytest.mark.only_profile("snowflake") +class TestEscapeSingleQuotesSnowflake(BaseEscapeSingleQuotesBackslash): + pass + + +@pytest.mark.only_profile("bigquery") +class TestEscapeSingleQuotesBigQuery(BaseEscapeSingleQuotesBackslash): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_except.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_except.py new file mode 100644 index 0000000..ad0c415 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_except.py @@ -0,0 +1,72 @@ +import pytest +from dbt.tests.util import run_dbt, check_relations_equal +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_except import ( + seeds__data_except_a_csv, + seeds__data_except_b_csv, + seeds__data_except_a_minus_b_csv, + seeds__data_except_b_minus_a_csv, + models__data_except_empty_sql, + models__test_except_a_minus_b_sql, + models__test_except_b_minus_a_sql, + models__test_except_a_minus_a_sql, + models__test_except_a_minus_empty_sql, + models__test_except_empty_minus_a_sql, + models__test_except_empty_minus_empty_sql, +) + + +class BaseExcept(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return { + "data_except_a.csv": seeds__data_except_a_csv, + "data_except_b.csv": seeds__data_except_b_csv, + "data_except_a_minus_b.csv": seeds__data_except_a_minus_b_csv, + "data_except_b_minus_a.csv": seeds__data_except_b_minus_a_csv, + } + + @pytest.fixture(scope="class") + def models(self): + return { + "data_except_empty.sql": models__data_except_empty_sql, + "test_except_a_minus_b.sql": models__test_except_a_minus_b_sql, + "test_except_b_minus_a.sql": models__test_except_b_minus_a_sql, + "test_except_a_minus_a.sql": models__test_except_a_minus_a_sql, + "test_except_a_minus_empty.sql": models__test_except_a_minus_empty_sql, + "test_except_empty_minus_a.sql": models__test_except_empty_minus_a_sql, + "test_except_empty_minus_empty.sql": models__test_except_empty_minus_empty_sql, + } + + def test_build_assert_equal(self, project): + run_dbt(['deps']) + run_dbt(['build']) + + check_relations_equal( + project.adapter, + ["test_except_a_minus_b", "data_except_a_minus_b"], + ) + check_relations_equal( + project.adapter, + ["test_except_b_minus_a", "data_except_b_minus_a"], + ) + check_relations_equal( + project.adapter, + ["test_except_a_minus_a", "data_except_empty"], + ) + check_relations_equal( + project.adapter, + ["test_except_a_minus_empty", "data_except_a"], + ) + check_relations_equal( + project.adapter, + ["test_except_empty_minus_a", "data_except_empty"], + ) + check_relations_equal( + project.adapter, + ["test_except_empty_minus_empty", "data_except_empty"], + ) + + +class TestExcept(BaseExcept): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_hash.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_hash.py new file mode 100644 index 0000000..d8454b2 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_hash.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_hash import ( + seeds__data_hash_csv, + models__test_hash_sql, + models__test_hash_yml, +) + + +class BaseHash(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_hash.csv": seeds__data_hash_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_hash.yml": models__test_hash_yml, + "test_hash.sql": models__test_hash_sql, + } + + +class TestHash(BaseHash): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_intersect.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_intersect.py new file mode 100644 index 0000000..b7e0ca9 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_intersect.py @@ -0,0 +1,70 @@ +import pytest +from dbt.tests.util import run_dbt, check_relations_equal +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_intersect import ( + seeds__data_intersect_a_csv, + seeds__data_intersect_b_csv, + seeds__data_intersect_a_overlap_b_csv, + models__data_intersect_empty_sql, + models__test_intersect_a_overlap_b_sql, + models__test_intersect_b_overlap_a_sql, + models__test_intersect_a_overlap_a_sql, + models__test_intersect_a_overlap_empty_sql, + models__test_intersect_empty_overlap_a_sql, + models__test_intersect_empty_overlap_empty_sql, +) + + +class BaseIntersect(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return { + "data_intersect_a.csv": seeds__data_intersect_a_csv, + "data_intersect_b.csv": seeds__data_intersect_b_csv, + "data_intersect_a_overlap_b.csv": seeds__data_intersect_a_overlap_b_csv, + } + + @pytest.fixture(scope="class") + def models(self): + return { + "data_intersect_empty.sql": models__data_intersect_empty_sql, + "test_intersect_a_overlap_b.sql": models__test_intersect_a_overlap_b_sql, + "test_intersect_b_overlap_a.sql": models__test_intersect_b_overlap_a_sql, + "test_intersect_a_overlap_a.sql": models__test_intersect_a_overlap_a_sql, + "test_intersect_a_overlap_empty.sql": models__test_intersect_a_overlap_empty_sql, + "test_intersect_empty_overlap_a.sql": models__test_intersect_empty_overlap_a_sql, + "test_intersect_empty_overlap_empty.sql": models__test_intersect_empty_overlap_empty_sql, + } + + def test_build_assert_equal(self, project): + run_dbt(['deps']) + run_dbt(['build']) + + check_relations_equal( + project.adapter, + ["test_intersect_a_overlap_b", "data_intersect_a_overlap_b"], + ) + check_relations_equal( + project.adapter, + ["test_intersect_b_overlap_a", "data_intersect_a_overlap_b"], + ) + check_relations_equal( + project.adapter, + ["test_intersect_a_overlap_a", "data_intersect_a"], + ) + check_relations_equal( + project.adapter, + ["test_intersect_a_overlap_empty", "data_intersect_empty"], + ) + check_relations_equal( + project.adapter, + ["test_intersect_empty_overlap_a", "data_intersect_empty"], + ) + check_relations_equal( + project.adapter, + ["test_intersect_empty_overlap_empty", "data_intersect_empty"], + ) + + +class TestIntersect(BaseIntersect): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_last_day.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_last_day.py new file mode 100644 index 0000000..f97e53a --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_last_day.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_last_day import ( + seeds__data_last_day_csv, + models__test_last_day_sql, + models__test_last_day_yml, +) + + +class BaseLastDay(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_last_day.csv": seeds__data_last_day_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_last_day.yml": models__test_last_day_yml, + "test_last_day.sql": models__test_last_day_sql, + } + + +class TestLastDay(BaseLastDay): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_length.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_length.py new file mode 100644 index 0000000..de6400e --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_length.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_length import ( + seeds__data_length_csv, + models__test_length_sql, + models__test_length_yml, +) + + +class BaseLength(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_length.csv": seeds__data_length_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_length.yml": models__test_length_yml, + "test_length.sql": models__test_length_sql, + } + + +class TestLength(BaseLength): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_listagg.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_listagg.py new file mode 100644 index 0000000..a62cf18 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_listagg.py @@ -0,0 +1,28 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_listagg import ( + seeds__data_listagg_csv, + seeds__data_listagg_output_csv, + models__test_listagg_sql, + models__test_listagg_yml, +) + + +class BaseListagg(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return { + "data_listagg.csv": seeds__data_listagg_csv, + "data_listagg_output.csv": seeds__data_listagg_output_csv, + } + + @pytest.fixture(scope="class") + def models(self): + return { + "test_listagg.yml": models__test_listagg_yml, + "test_listagg.sql": models__test_listagg_sql, + } + + +class TestListagg(BaseListagg): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_position.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_position.py new file mode 100644 index 0000000..6ab6512 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_position.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_position import ( + seeds__data_position_csv, + models__test_position_sql, + models__test_position_yml, +) + + +class BasePosition(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_position.csv": seeds__data_position_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_position.yml": models__test_position_yml, + "test_position.sql": models__test_position_sql, + } + + +class TestPosition(BasePosition): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_replace.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_replace.py new file mode 100644 index 0000000..6568cbc --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_replace.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_replace import ( + seeds__data_replace_csv, + models__test_replace_sql, + models__test_replace_yml, +) + + +class BaseReplace(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_replace.csv": seeds__data_replace_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_replace.yml": models__test_replace_yml, + "test_replace.sql": models__test_replace_sql, + } + + +class TestReplace(BaseReplace): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_right.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_right.py new file mode 100644 index 0000000..13b24a8 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_right.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_right import ( + seeds__data_right_csv, + models__test_right_sql, + models__test_right_yml, +) + + +class BaseRight(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_right.csv": seeds__data_right_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_right.yml": models__test_right_yml, + "test_right.sql": models__test_right_sql, + } + + +class TestRight(BaseRight): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_safe_cast.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_safe_cast.py new file mode 100644 index 0000000..979bd5d --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_safe_cast.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_safe_cast import ( + seeds__data_safe_cast_csv, + models__test_safe_cast_sql, + models__test_safe_cast_yml, +) + + +class BaseSafeCast(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_safe_cast.csv": seeds__data_safe_cast_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_safe_cast.yml": models__test_safe_cast_yml, + "test_safe_cast.sql": models__test_safe_cast_sql, + } + + +class TestSafeCast(BaseSafeCast): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_split_part.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_split_part.py new file mode 100644 index 0000000..5968f41 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_split_part.py @@ -0,0 +1,24 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_split_part import ( + seeds__data_split_part_csv, + models__test_split_part_sql, + models__test_split_part_yml, +) + + +class BaseSplitPart(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_split_part.csv": seeds__data_split_part_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_split_part.yml": models__test_split_part_yml, + "test_split_part.sql": models__test_split_part_sql, + } + + +class TestSplitPart(BaseSplitPart): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_string_literal.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_string_literal.py new file mode 100644 index 0000000..9fb01cf --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_string_literal.py @@ -0,0 +1,19 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_string_literal import ( + models__test_string_literal_sql, + models__test_string_literal_yml, +) + + +class BaseStringLiteral(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def models(self): + return { + "test_string_literal.yml": models__test_string_literal_yml, + "test_string_literal.sql": models__test_string_literal_sql, + } + + +class TestStringLiteral(BaseStringLiteral): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_bigint.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_bigint.py new file mode 100644 index 0000000..81b0423 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_bigint.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_bigint import ( + seeds__data_type_bigint_csv, + models__test_type_bigint_sql, + models__test_type_bigint_yml, +) + + +class BaseTypeBigint(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_bigint.csv": seeds__data_type_bigint_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_bigint.yml": models__test_type_bigint_yml, + "test_type_bigint.sql": models__test_type_bigint_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeBigint(BaseTypeBigint): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_boolean.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_boolean.py new file mode 100644 index 0000000..83c7d76 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_boolean.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_boolean import ( + seeds__data_type_boolean_csv, + models__test_type_boolean_sql, + models__test_type_boolean_yml, +) + + +class BaseTypeBoolean(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_boolean.csv": seeds__data_type_boolean_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_boolean.yml": models__test_type_boolean_yml, + "test_type_boolean.sql": models__test_type_boolean_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeBoolean(BaseTypeBoolean): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_float.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_float.py new file mode 100644 index 0000000..9038097 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_float.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_float import ( + seeds__data_type_float_csv, + models__test_type_float_sql, + models__test_type_float_yml, +) + + +class BaseTypeFloat(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_float.csv": seeds__data_type_float_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_float.yml": models__test_type_float_yml, + "test_type_float.sql": models__test_type_float_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeFloat(BaseTypeFloat): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_int.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_int.py new file mode 100644 index 0000000..d05669e --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_int.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_int import ( + seeds__data_type_int_csv, + models__test_type_int_sql, + models__test_type_int_yml, +) + + +class BaseTypeInt(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_int.csv": seeds__data_type_int_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_int.yml": models__test_type_int_yml, + "test_type_int.sql": models__test_type_int_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeInt(BaseTypeInt): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_numeric.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_numeric.py new file mode 100644 index 0000000..a337e57 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_numeric.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_numeric import ( + seeds__data_type_numeric_csv, + models__test_type_numeric_sql, + models__test_type_numeric_yml, +) + + +class BaseTypeNumeric(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_numeric.csv": seeds__data_type_numeric_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_numeric.yml": models__test_type_numeric_yml, + "test_type_numeric.sql": models__test_type_numeric_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeNumeric(BaseTypeNumeric): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_string.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_string.py new file mode 100644 index 0000000..16e9478 --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_string.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_string import ( + seeds__data_type_string_csv, + models__test_type_string_sql, + models__test_type_string_yml, +) + + +class BaseTypeString(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_string.csv": seeds__data_type_string_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_string.yml": models__test_type_string_yml, + "test_type_string.sql": models__test_type_string_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeString(BaseTypeString): + pass diff --git a/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_timestamp.py b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_timestamp.py new file mode 100644 index 0000000..3244f5c --- /dev/null +++ b/dbt_packages/dbt_utils/tests/functional/cross_db_utils/test_type_timestamp.py @@ -0,0 +1,25 @@ +import pytest +from tests.functional.cross_db_utils.base_cross_db_macro import BaseCrossDbMacro +from tests.functional.cross_db_utils.fixture_type_timestamp import ( + seeds__data_type_timestamp_csv, + models__test_type_timestamp_sql, + models__test_type_timestamp_yml, +) + + +class BaseTypeTimestamp(BaseCrossDbMacro): + @pytest.fixture(scope="class") + def seeds(self): + return {"data_type_timestamp.csv": seeds__data_type_timestamp_csv} + + @pytest.fixture(scope="class") + def models(self): + return { + "test_type_timestamp.yml": models__test_type_timestamp_yml, + "test_type_timestamp.sql": models__test_type_timestamp_sql, + } + + +@pytest.mark.skip(reason="TODO - implement this test") +class TestTypeTimestamp(BaseTypeTimestamp): + pass diff --git a/dbt_packages/fivetran_utils b/dbt_packages/fivetran_utils new file mode 160000 index 0000000..8911df2 --- /dev/null +++ b/dbt_packages/fivetran_utils @@ -0,0 +1 @@ +Subproject commit 8911df2a22e96c7f2809270180c7925e142fcd6f diff --git a/dbt_packages/google_ads/.circleci/config.yml b/dbt_packages/google_ads/.circleci/config.yml new file mode 100644 index 0000000..730080f --- /dev/null +++ b/dbt_packages/google_ads/.circleci/config.yml @@ -0,0 +1,82 @@ +version: 2 + +jobs: + build: + docker: + - image: circleci/python:3.7.9-stretch + + steps: + - checkout + + - run: + run: setup_creds + command: | + echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json + - run: + name: "Setup dbt" + command: | + sudo apt install libsasl2-dev + python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip setuptools + pip install -r integration_tests/requirements.txt + mkdir -p ~/.dbt + cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml + - run: + name: "Run Tests - Postgres" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target postgres --full-refresh + dbt run --target postgres --full-refresh + dbt run --target postgres --full-refresh --vars '{api_source: adwords}' + dbt test --target postgres + - run: + name: "Run Tests - Spark" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target spark --full-refresh + dbt run --target spark --full-refresh + dbt run --target spark --full-refresh --vars '{api_source: adwords}' + dbt test --target spark + - run: + name: "Run Tests - Redshift" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target redshift --full-refresh + dbt run --target redshift --full-refresh + dbt run --target redshift --full-refresh --vars '{api_source: adwords}' + dbt test --target redshift + - run: + name: "Run Tests - Snowflake" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target snowflake --full-refresh + dbt run --target snowflake --full-refresh + dbt run --target snowflake --full-refresh --vars '{api_source: adwords}' + dbt test --target snowflake + - run: + name: "Run Tests - BigQuery" + environment: + GCLOUD_SERVICE_KEY_PATH: "/home/circleci/gcloud-service-key.json" + + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target bigquery --full-refresh + dbt run --target bigquery --full-refresh + dbt run --target bigquery --full-refresh --vars '{api_source: adwords}' + dbt test --target bigquery \ No newline at end of file diff --git a/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/bug-report.yml b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..17c2c54 --- /dev/null +++ b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,88 @@ +name: 🐞 Bug +description: Report a bug or an issue you've found within the dbt package +title: "[Bug] " +labels: ["bug", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this bug report. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the issue + description: A concise description of the problem you're experiencing. Also, please provide the steps to reproduce the issue if applicable. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant error log or model output + description: | + If applicable, provide the relevant error log or describe the problematic model output. + render: shell + validations: + required: false + - type: textarea + attributes: + label: Expected behavior + description: A concise description of what you expected to happen. + validations: + required: true + - type: textarea + attributes: + label: dbt Project configurations + description: Please provide the variables and any other project specific configurations from your `dbt_project.yml`. + validations: + required: true + - type: textarea + attributes: + label: Package versions + description: Please provide the contents of your `packages.yml`. + validations: + required: true + - type: dropdown + id: database + attributes: + label: What database are you using dbt with? + multiple: true + options: + - postgres + - redshift + - snowflake + - bigquery + - databricks + - other (mention it in "Additional Context") + validations: + required: true + - type: textarea + attributes: + label: dbt Version + description: Run `dbt --version` in your CLI or dbt cloud environment and copy the contents. Additionally, if you are using Fivetran dbt Transformations, provide the contents of the `dbtVersion` configuration in your `deployment.yml`. + validations: + required: true + - type: textarea + attributes: + label: Additional Context + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: checkboxes + id: pr + attributes: + label: Are you willing to open a PR to help address this issue? + description: Our team will assess this issue and let you know if we will add it to a future sprint. However, if you would like to expedite the solution, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during our [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance + - label: No. + required: false \ No newline at end of file diff --git a/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/config.yml b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..65a074b --- /dev/null +++ b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,13 @@ +contact_links: + - name: Ask a question during our office hours + url: https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours + about: Schedule time during the external office hours block with the Fivetran Analytics Engineering team for support + - name: Fivetran connector question + url: https://support.fivetran.com/hc + about: Have a question about your connector? Check out the Fivetran support portal for more details. + - name: What is dbt + url: https://docs.getdbt.com/docs/introduction + about: Check out the dbt docs for all dbt related information + - name: Hang out in dbt Slack + url: https://www.getdbt.com/community/ + about: Have a question or just want to chat with fellow data friends, join dbt Slack and hangout in the tools-fivetran channel with us! \ No newline at end of file diff --git a/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/feature-request.yml b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..a1d28bb --- /dev/null +++ b/dbt_packages/google_ads/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,46 @@ +name: 🎉 Feature +description: Suggest a new feature for the Fivetran dbt package +title: "[Feature] <title>" +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this feature request. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing feature request for this? + description: Please search to see if an issue already exists for the feature you would like. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the Feature + description: A clear and concise description of what you want to happen and why you want the new feature. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: checkboxes + id: contributing + attributes: + label: Are you interested in contributing this feature? + description: Our team will assess this feature and let you know if we will add it to a future sprint. However, if you would like to expedite the feature, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during your [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance. + - label: No. + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the feature you are suggesting! + validations: + required: false diff --git a/dbt_packages/google_ads/.github/pull_request_template.md b/dbt_packages/google_ads/.github/pull_request_template.md new file mode 100644 index 0000000..f450926 --- /dev/null +++ b/dbt_packages/google_ads/.github/pull_request_template.md @@ -0,0 +1,52 @@ +**Are you a current Fivetran customer?** +<!--- Please tell us your name, title and company --> + +**What change(s) does this PR introduce?** +<!--- Describe what changes your PR introduces to the package and how to leverage this new feature. --> + +**Did you update the CHANGELOG?** +<!--- Please update the new package version’s CHANGELOG entry detailing the changes included in this PR. --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes + +**Does this PR introduce a breaking change?** +<!--- Does this PR introduce changes that will cause current package users' jobs to fail or require a `--full-refresh`? --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes (please provide breaking change details below.) +- [ ] No (please provide an explanation as to how the change is non-breaking below.) + +**Did you update the dbt_project.yml files with the version upgrade (please leverage standard semantic versioning)? (In both your main project and integration_tests)** +<!--- The dbt_project.yml and the integration_tests/dbt_project.yml files contain the version number. Be sure to upgrade it accordingly --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes + +**Is this PR in response to a previously created Bug or Feature Request** +<!--- If an Issue was created it is helpful to track the progress by linking it in the PR. --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes, Issue/Feature [link bug/feature number here] +- [ ] No + +**How did you test the PR changes?** +<!--- Proof of testing is required in order for the PR to be approved. --> +<!--- To check a box, remove the space and insert an x in the box (eg. [x] CircleCi). --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] CircleCi <!--- CircleCi testing is only applicable to Fivetran employees. --> +- [ ] Local (please provide additional testing details below) + +**Select which warehouse(s) were used to test the PR** +<!--- To check a warehouse remove the space and insert an x in the box (eg. [x] Bigquery). --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] BigQuery +- [ ] Redshift +- [ ] Snowflake +- [ ] Postgres +- [ ] Databricks +- [ ] Other (provide details below) + +**Provide an emoji that best describes your current mood** +<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) --> +:dancer: + +**Feedback** + +We are so excited you decided to contribute to the Fivetran community dbt package! We continue to work to improve the packages and would greatly appreciate your [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next. diff --git a/dbt_packages/google_ads/.gitignore b/dbt_packages/google_ads/.gitignore new file mode 100644 index 0000000..2710741 --- /dev/null +++ b/dbt_packages/google_ads/.gitignore @@ -0,0 +1,6 @@ + +target/ +dbt_modules/ +logs/ + +dbt_packages/ \ No newline at end of file diff --git a/dbt_packages/google_ads/CHANGELOG.md b/dbt_packages/google_ads/CHANGELOG.md new file mode 100644 index 0000000..ddd6909 --- /dev/null +++ b/dbt_packages/google_ads/CHANGELOG.md @@ -0,0 +1,21 @@ +# dbt_google_ads v0.7.0 +## 🚨 Breaking Changes 🚨 +- The `api_source` variable is now defaulted to `google_ads` as opposed to `adwords`. The Adwords API has since been deprecated by Google and is now no longer the standard API for the Google Ads connector. Please ensure you are using a Google Ads API version of the Fivetran connector before upgrading this package. ([#32](https://github.com/fivetran/dbt_google_ads/pull/32)) + - Please note, the `adwords` version of this package will be fully removed from the package in August of 2022. This means, models under `models/adwords_connector` will be removed in favor of `models/google_ads_connector` models. +# dbt_google_ads v0.6.1 +- Updated google_ads__url_ad_adapter link in README (Thank you to @bkimjin! ([#26](https://github.com/fivetran/dbt_google_ads/issues/26))) +# dbt_google_ads v0.6.0 +## 🚨 Breaking Changes 🚨 +- The `account` source table has been renamed to be `account_history`. This has been reflected in the source model references within this release. ([#24](https://github.com/fivetran/dbt_google_ads_source/pull/24)) +- The `ad_final_url_history` model has been removed from the connector. The url fields are now references within the `final_urls` field within the `ad_history` table. These changes are reflected in the `google_ads__url_adapter` model. ([#24](https://github.com/fivetran/dbt_google_ads_source/pull/24)) +# dbt_google_ads v0.5.0 +🎉 dbt v1.0.0 Compatibility 🎉 +## 🚨 Breaking Changes 🚨 +- Adjusts the `require-dbt-version` to now be within the range [">=1.0.0", "<2.0.0"]. Additionally, the package has been updated for dbt v1.0.0 compatibility. If you are using a dbt version <1.0.0, you will need to upgrade in order to leverage the latest version of the package. + - For help upgrading your package, I recommend reviewing this GitHub repo's Release Notes on what changes have been implemented since your last upgrade. + - For help upgrading your dbt project to dbt v1.0.0, I recommend reviewing dbt-labs [upgrading to 1.0.0 docs](https://docs.getdbt.com/docs/guides/migration-guide/upgrading-to-1-0-0) for more details on what changes must be made. +- Upgrades the package dependency to refer to the latest `dbt_google_ads_source`. Additionally, the latest `dbt_google_ads_source` package has a dependency on the latest `dbt_fivetran_utils`. Further, the latest `dbt_fivetran_utils` package also has a dependency on `dbt_utils` [">=0.8.0", "<0.9.0"]. + - Please note, if you are installing a version of `dbt_utils` in your `packages.yml` that is not in the range above then you will encounter a package dependency error. + +# dbt_google_ads v0.1.0 -> v0.4.0 +Refer to the relevant release notes on the Github repository for specific details for the previous releases. Thank you! diff --git a/dbt_packages/google_ads/LICENSE b/dbt_packages/google_ads/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/dbt_packages/google_ads/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/dbt_packages/google_ads/README.md b/dbt_packages/google_ads/README.md new file mode 100644 index 0000000..37d42e1 --- /dev/null +++ b/dbt_packages/google_ads/README.md @@ -0,0 +1,196 @@ +[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +# Google Ads + +This package models Google Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/google-ads). + +The main focus of the package is to transform the core ad object tables into analytics-ready models, including an 'ad adapter' model that can be easily unioned in to other ad platform packages to get a single view. This is especially easy using our [Ad Reporting package](https://github.com/fivetran/dbt_ad_reporting). + +## Models + +This package contains transformation models, designed to work simultaneously with our [Google Ads source package](https://github.com/fivetran/dbt_google_ads_source) and our [multi-platform Ad Reporting package](https://github.com/fivetran/dbt_ad_reporting). A dependency on the source package is declared in this package's `packages.yml` file, so it will automatically download when you run `dbt deps`. The primary outputs of this package are described below. + +> Please note this package allows for either `Adwords API` or `Google Ads API` connector configuration. For specific API configuration instructions refer to the [Google Ads source package](https://github.com/fivetran/dbt_google_ads_source). Additionally, not all final models will be generated based off the API being used. Refer to the table below for an understanding of which models will be created per API. + +| **model** | **description** |**compatible API** | +| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |------------------------------- | +| [google_ads__url_ad_adapter](https://github.com/fivetran/dbt_google_ads/blob/main/models/url_google_ads/google_ads__url_ad_adapter.sql) | Each record represents the daily ad performance of each URL in each ad group, including information about the used UTM parameters. | Adwords API and Google Ads API | +| [google_ads__criteria_ad_adapter](https://github.com/fivetran/dbt_google_ads/blob/main/models/criteria/google_ads__criteria_ad_adapter.sql) | Each record represents the daily ad performance of each criteria in each ad group. | Adwords API Only| +| [google_ads__click_performance](https://github.com/fivetran/dbt_google_ads/blob/main/models/google_ads__click_performance.sql) | Each record represents a click, with a corresponding Google click ID (gclid). | Adwords API Only | + +## Installation Instructions +Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions, or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. + +Include in your `packages.yml` + +```yaml +packages: + - package: fivetran/google_ads + version: [">=0.7.0", "<0.8.0"] +``` + +## Configuration + +This package allows users to leverage either the Adwords API or the Google Ads API. You will be able to determine which API your connector is using by navigating within your Fivetran UI to the `setup` tab -> `edit connection details` link -> and reference the `API configuration` used. You will want to refer to the respective configuration steps below based off the API used by your connector. + +> **Note**: As of April, 2022 all Fivetran Google Ads connectors leverage the Google Ads API rather than Adwords. Additionally, please be aware that the Adwords API version of the package will be sunset in August of 2022. +### Google Ads API Configuration +If your connector is setup using the Google Ads API then you will need to configure your `dbt_project.yml` with the below variable: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + api_source: google_ads ## google_ads by default, but may be changed to 'adwords' if using a previous version of the connector. +``` + +### Adwords API Configuration +If your connector is setup using the Adwords API then you will need to pull the following custom reports through Fivetran: + +* Destination Table Name: `final_url_performance` +* Report Type: `FINAL_URL_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * Cost + * Date + * EffectiveFinalUrl + * ExternalCustomerId + * Impressions + +* Destination Table Name: `criteria_performance` +* Report Type: `CRITERIA_PERFORMANCE_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * Cost + * Criteria + * CriteriaDestinationUrl + * CriteriaType + * Date + * ExternalCustomerId + * Id + * Impressions + +* Destination Table Name: `click_performance` +* Report Type: `CLICK_PERFORMANCE_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * CriteriaId + * Date + * ExternalCustomerId + * GclId + +The package assumes that the corresponding destination tables are named `final_url_performance`, `criteria_performance`, and `click_performance` respectively. If these tables have different names in your destination, enter the correct table names in the `google_ads__final_url_performance`, `google_ads__click_performance`, and `google_ads__criteria_performance` variables so that the package can find them: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + google_ads__final_url_performance: "{{ ref('a_model_you_wrote') }}" + google_ads__click_performance: adwords.click_performance_report +``` +### Source Schema is Named Differently +By default, this package will look for your Google Ads data in the `adwords` schema of your [target database](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile). If this is not where your Google Ads data is, please add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + google_ads_source: + google_ads_schema: your_schema_name + google_ads_database: your_database_name +``` + +For additional configurations for the source models, visit the [Google Ads source package](https://github.com/fivetran/dbt_google_ads_source). + +## Optional Configurations +### Passing Through Additional Metrics +By default, this package will select `clicks`, `impressions`, and `cost` from the source reporting tables to store into the ad adapter models. If you would like to pass through additional metrics to the ad adapter models, add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +vars: + # If you're using the Adwords API source + google_ads__url_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from adwords.final_url_performance + google_ads__criteria_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from adwords.criteria_performance + # If you're using the Google Ads API source + google_ads__ad_stats_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from google_ads.ad_stats +``` + +### Changing the Build Schema +By default this package will build the Google Ads staging models within a schema titled (<target_schema> + `_stg_google_ads`) and the Google Ads final models with a schema titled (<target_schema> + `_google_ads`) in your target database. If this is not where you would like your modeled Google Ads data to be written to, add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +models: + google_ads: + +schema: my_new_schema_name # leave blank for just the target_schema + google_ads_source: + +schema: my_new_schema_name # leave blank for just the target_schema +``` + +## Database Support + +This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks. + +### Databricks Dispatch Configuration +dbt `v0.20.0` introduced a new project-level dispatch configuration that enables an "override" setting for all dispatched macros. If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively. +```yml +# dbt_project.yml + +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] +``` + +## Contributions + +Additional contributions to this package are very welcome! Please create issues +or open PRs against `main`. Check out +[this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) +on the best workflow for contributing to a package. + +## Resources: +- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next +- Have questions, feedback, or need help? Book a time during our office hours [using Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at solutions@fivetran.com +- Find all of Fivetran's pre-built dbt packages in our [dbt hub](https://hub.getdbt.com/fivetran/) +- Learn how to orchestrate your models with [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt) +- Learn more about Fivetran overall [in our docs](https://fivetran.com/docs) +- Check out [Fivetran's blog](https://fivetran.com/blog) +- Learn more about dbt [in the dbt docs](https://docs.getdbt.com/docs/introduction) +- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers +- Join the [chat](http://slack.getdbt.com/) on Slack for live discussions and support +- Find [dbt events](https://events.getdbt.com) near you +- Check out [the dbt blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices diff --git a/dbt_packages/google_ads/dbt_project.yml b/dbt_packages/google_ads/dbt_project.yml new file mode 100644 index 0000000..1f52a16 --- /dev/null +++ b/dbt_packages/google_ads/dbt_project.yml @@ -0,0 +1,23 @@ +name: 'google_ads' +version: '0.7.0' +config-version: 2 +require-dbt-version: [">=1.0.0", "<2.0.0"] +models: + google_ads: + +schema: google_ads + +materialized: table +vars: + google_ads: + click_performance: "{{ ref('stg_google_ads__click_performance') }}" + final_url_performance: "{{ ref('stg_google_ads__final_url_performance') }}" + criteria_performance: "{{ ref('stg_google_ads__criteria_performance') }}" + ad_stats: "{{ ref('stg_google_ads__ad_stats') }}" + account_history: "{{ ref('stg_google_ads__account_history') }}" + campaign_history: "{{ ref('stg_google_ads__campaign_history') }}" + ad_group_history: "{{ ref('stg_google_ads__ad_group_history') }}" + ad_history: "{{ ref('stg_google_ads__ad_history') }}" + ad_final_url_history: "{{ ref('stg_google_ads__ad_final_url_history') }}" + api_source: google_ads + google_ads__url_passthrough_metrics: [] + google_ads__criteria_passthrough_metrics: [] + google_ads__ad_stats_passthrough_metrics: [] diff --git a/dbt_packages/google_ads/docs/catalog.json b/dbt_packages/google_ads/docs/catalog.json new file mode 100644 index 0000000..ab97e48 --- /dev/null +++ b/dbt_packages/google_ads/docs/catalog.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.1", "generated_at": "2022-02-04T17:16:51.615296Z", "invocation_id": "eb911fd0-a551-4c69-a36a-f5df3bb4d6e6", "env": {}}, "nodes": {"seed.google_ads_integration_tests.google_ads_account_history_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_account_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "integer", "index": 1, "name": "id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "timestamp without time zone", "index": 3, "name": "_fivetran_synced", "comment": null}, "auto_tagging_enabled": {"type": "boolean", "index": 4, "name": "auto_tagging_enabled", "comment": null}, "currency_code": {"type": "text", "index": 5, "name": "currency_code", "comment": null}, "descriptive_name": {"type": "integer", "index": 6, "name": "descriptive_name", "comment": null}, "final_url_suffix": {"type": "boolean", "index": 7, "name": "final_url_suffix", "comment": null}, "hidden": {"type": "boolean", "index": 8, "name": "hidden", "comment": null}, "manager": {"type": "integer", "index": 9, "name": "manager", "comment": null}, "manager_customer_id": {"type": "double precision", "index": 10, "name": "manager_customer_id", "comment": null}, "optimization_score": {"type": "text", "index": 11, "name": "optimization_score", "comment": null}, "pay_per_conversion_eligibility_failure_reasons": {"type": "boolean", "index": 12, "name": "pay_per_conversion_eligibility_failure_reasons", "comment": null}, "test_account": {"type": "text", "index": 13, "name": "test_account", "comment": null}, "time_zone": {"type": "integer", "index": 14, "name": "time_zone", "comment": null}, "tracking_url_template": {"type": "integer", "index": 15, "name": "tracking_url_template", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.google_ads_integration_tests.google_ads_account_history_data"}, "seed.google_ads_integration_tests.google_ads_ad_group_history_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_ad_group_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "bigint", "index": 1, "name": "id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "timestamp without time zone", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_group_rotation_mode": {"type": "text", "index": 4, "name": "ad_group_rotation_mode", "comment": null}, "ad_group_type": {"type": "text", "index": 5, "name": "ad_group_type", "comment": null}, "base_ad_group_id": {"type": "bigint", "index": 6, "name": "base_ad_group_id", "comment": null}, "base_campaign_id": {"type": "bigint", "index": 7, "name": "base_campaign_id", "comment": null}, "bidding_strategy_bid_ceiling": {"type": "integer", "index": 8, "name": "bidding_strategy_bid_ceiling", "comment": null}, "bidding_strategy_bid_changes_for_raises_only": {"type": "integer", "index": 9, "name": "bidding_strategy_bid_changes_for_raises_only", "comment": null}, "bidding_strategy_bid_floor": {"type": "integer", "index": 10, "name": "bidding_strategy_bid_floor", "comment": null}, "bidding_strategy_bid_modifier": {"type": "integer", "index": 11, "name": "bidding_strategy_bid_modifier", "comment": null}, "bidding_strategy_competitor_domain": {"type": "integer", "index": 12, "name": "bidding_strategy_competitor_domain", "comment": null}, "bidding_strategy_cpa_bid_amount": {"type": "integer", "index": 13, "name": "bidding_strategy_cpa_bid_amount", "comment": null}, "bidding_strategy_cpc_bid_amount": {"type": "integer", "index": 14, "name": "bidding_strategy_cpc_bid_amount", "comment": null}, "bidding_strategy_cpm_bid_amount": {"type": "integer", "index": 15, "name": "bidding_strategy_cpm_bid_amount", "comment": null}, "bidding_strategy_enhanced_cpc_enabled": {"type": "integer", "index": 16, "name": "bidding_strategy_enhanced_cpc_enabled", "comment": null}, "bidding_strategy_id": {"type": "integer", "index": 17, "name": "bidding_strategy_id", "comment": null}, "bidding_strategy_max_cpc_bid_ceiling": {"type": "integer", "index": 18, "name": "bidding_strategy_max_cpc_bid_ceiling", "comment": null}, "bidding_strategy_max_cpc_bid_floor": {"type": "integer", "index": 19, "name": "bidding_strategy_max_cpc_bid_floor", "comment": null}, "bidding_strategy_name": {"type": "integer", "index": 20, "name": "bidding_strategy_name", "comment": null}, "bidding_strategy_raise_bid_when_budget_constrained": {"type": "integer", "index": 21, "name": "bidding_strategy_raise_bid_when_budget_constrained", "comment": null}, "bidding_strategy_raise_bid_when_low_quality_score": {"type": "integer", "index": 22, "name": "bidding_strategy_raise_bid_when_low_quality_score", "comment": null}, "bidding_strategy_scheme_type": {"type": "integer", "index": 23, "name": "bidding_strategy_scheme_type", "comment": null}, "bidding_strategy_source": {"type": "integer", "index": 24, "name": "bidding_strategy_source", "comment": null}, "bidding_strategy_spend_target": {"type": "integer", "index": 25, "name": "bidding_strategy_spend_target", "comment": null}, "bidding_strategy_strategy_goal": {"type": "integer", "index": 26, "name": "bidding_strategy_strategy_goal", "comment": null}, "bidding_strategy_target_cpa": {"type": "integer", "index": 27, "name": "bidding_strategy_target_cpa", "comment": null}, "bidding_strategy_target_outrank_share": {"type": "integer", "index": 28, "name": "bidding_strategy_target_outrank_share", "comment": null}, "bidding_strategy_target_roas": {"type": "integer", "index": 29, "name": "bidding_strategy_target_roas", "comment": null}, "bidding_strategy_target_roas_override": {"type": "integer", "index": 30, "name": "bidding_strategy_target_roas_override", "comment": null}, "bidding_strategy_type": {"type": "text", "index": 31, "name": "bidding_strategy_type", "comment": null}, "bidding_strategy_viewable_cpm_enabled": {"type": "integer", "index": 32, "name": "bidding_strategy_viewable_cpm_enabled", "comment": null}, "campaign_id": {"type": "bigint", "index": 33, "name": "campaign_id", "comment": null}, "content_bid_criterion_type_group": {"type": "text", "index": 34, "name": "content_bid_criterion_type_group", "comment": null}, "final_url_suffix": {"type": "integer", "index": 35, "name": "final_url_suffix", "comment": null}, "status": {"type": "text", "index": 36, "name": "status", "comment": null}, "tracking_url_template": {"type": "integer", "index": 37, "name": "tracking_url_template", "comment": null}, "campaign_name": {"type": "text", "index": 38, "name": "campaign_name", "comment": null}, "name": {"type": "text", "index": 39, "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": "seed.google_ads_integration_tests.google_ads_ad_group_history_data"}, "seed.google_ads_integration_tests.google_ads_ad_history_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_ad_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_group_id": {"type": "bigint", "index": 1, "name": "ad_group_id", "comment": null}, "id": {"type": "bigint", "index": 2, "name": "id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 3, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "text", "index": 4, "name": "_fivetran_synced", "comment": null}, "action_items": {"type": "text", "index": 5, "name": "action_items", "comment": null}, "ad_strength": {"type": "text", "index": 6, "name": "ad_strength", "comment": null}, "added_by_google_ads": {"type": "boolean", "index": 7, "name": "added_by_google_ads", "comment": null}, "device_preference": {"type": "text", "index": 8, "name": "device_preference", "comment": null}, "display_url": {"type": "integer", "index": 9, "name": "display_url", "comment": null}, "final_app_urls": {"type": "text", "index": 10, "name": "final_app_urls", "comment": null}, "final_mobile_urls": {"type": "text", "index": 11, "name": "final_mobile_urls", "comment": null}, "final_url_suffix": {"type": "integer", "index": 12, "name": "final_url_suffix", "comment": null}, "final_urls": {"type": "text", "index": 13, "name": "final_urls", "comment": null}, "name": {"type": "integer", "index": 14, "name": "name", "comment": null}, "policy_summary_approval_status": {"type": "text", "index": 15, "name": "policy_summary_approval_status", "comment": null}, "policy_summary_review_status": {"type": "text", "index": 16, "name": "policy_summary_review_status", "comment": null}, "status": {"type": "text", "index": 17, "name": "status", "comment": null}, "system_managed_resource_source": {"type": "text", "index": 18, "name": "system_managed_resource_source", "comment": null}, "tracking_url_template": {"type": "integer", "index": 19, "name": "tracking_url_template", "comment": null}, "type": {"type": "text", "index": 20, "name": "type", "comment": null}, "url_collections": {"type": "text", "index": 21, "name": "url_collections", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.google_ads_integration_tests.google_ads_ad_history_data"}, "seed.google_ads_integration_tests.google_ads_ad_stats_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_ad_stats_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "customer_id": {"type": "bigint", "index": 2, "name": "customer_id", "comment": null}, "date": {"type": "date", "index": 3, "name": "date", "comment": null}, "_fivetran_synced": {"type": "timestamp without time zone", "index": 4, "name": "_fivetran_synced", "comment": null}, "active_view_impressions": {"type": "integer", "index": 5, "name": "active_view_impressions", "comment": null}, "active_view_measurability": {"type": "integer", "index": 6, "name": "active_view_measurability", "comment": null}, "active_view_measurable_cost_micros": {"type": "integer", "index": 7, "name": "active_view_measurable_cost_micros", "comment": null}, "active_view_measurable_impressions": {"type": "integer", "index": 8, "name": "active_view_measurable_impressions", "comment": null}, "active_view_viewability": {"type": "integer", "index": 9, "name": "active_view_viewability", "comment": null}, "ad_group": {"type": "text", "index": 10, "name": "ad_group", "comment": null}, "ad_group_base_ad_group": {"type": "text", "index": 11, "name": "ad_group_base_ad_group", "comment": null}, "ad_id": {"type": "bigint", "index": 12, "name": "ad_id", "comment": null}, "ad_network_type": {"type": "text", "index": 13, "name": "ad_network_type", "comment": null}, "campaign_base_campaign": {"type": "text", "index": 14, "name": "campaign_base_campaign", "comment": null}, "campaign_id": {"type": "bigint", "index": 15, "name": "campaign_id", "comment": null}, "clicks": {"type": "integer", "index": 16, "name": "clicks", "comment": null}, "conversions": {"type": "integer", "index": 17, "name": "conversions", "comment": null}, "conversions_value": {"type": "integer", "index": 18, "name": "conversions_value", "comment": null}, "cost_micros": {"type": "integer", "index": 19, "name": "cost_micros", "comment": null}, "device": {"type": "text", "index": 20, "name": "device", "comment": null}, "impressions": {"type": "integer", "index": 21, "name": "impressions", "comment": null}, "interaction_event_types": {"type": "text", "index": 22, "name": "interaction_event_types", "comment": null}, "interactions": {"type": "integer", "index": 23, "name": "interactions", "comment": null}, "keyword_ad_group_criterion": {"type": "text", "index": 24, "name": "keyword_ad_group_criterion", "comment": null}, "view_through_conversions": {"type": "integer", "index": 25, "name": "view_through_conversions", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.google_ads_integration_tests.google_ads_ad_stats_data"}, "seed.google_ads_integration_tests.google_ads_campaign_history_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_campaign_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "bigint", "index": 1, "name": "id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "timestamp without time zone", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_serving_optimization_status": {"type": "text", "index": 4, "name": "ad_serving_optimization_status", "comment": null}, "advertising_channel_subtype": {"type": "text", "index": 5, "name": "advertising_channel_subtype", "comment": null}, "advertising_channel_type": {"type": "text", "index": 6, "name": "advertising_channel_type", "comment": null}, "base_campaign_id": {"type": "bigint", "index": 7, "name": "base_campaign_id", "comment": null}, "bidding_strategy_bid_ceiling": {"type": "integer", "index": 8, "name": "bidding_strategy_bid_ceiling", "comment": null}, "bidding_strategy_bid_changes_for_raises_only": {"type": "integer", "index": 9, "name": "bidding_strategy_bid_changes_for_raises_only", "comment": null}, "bidding_strategy_bid_floor": {"type": "integer", "index": 10, "name": "bidding_strategy_bid_floor", "comment": null}, "bidding_strategy_bid_modifier": {"type": "integer", "index": 11, "name": "bidding_strategy_bid_modifier", "comment": null}, "bidding_strategy_competitor_domain": {"type": "integer", "index": 12, "name": "bidding_strategy_competitor_domain", "comment": null}, "bidding_strategy_cpa_bid_amount": {"type": "integer", "index": 13, "name": "bidding_strategy_cpa_bid_amount", "comment": null}, "bidding_strategy_cpc_bid_amount": {"type": "integer", "index": 14, "name": "bidding_strategy_cpc_bid_amount", "comment": null}, "bidding_strategy_cpm_bid_amount": {"type": "integer", "index": 15, "name": "bidding_strategy_cpm_bid_amount", "comment": null}, "bidding_strategy_enhanced_cpc_enabled": {"type": "integer", "index": 16, "name": "bidding_strategy_enhanced_cpc_enabled", "comment": null}, "bidding_strategy_id": {"type": "integer", "index": 17, "name": "bidding_strategy_id", "comment": null}, "bidding_strategy_max_cpc_bid_ceiling": {"type": "integer", "index": 18, "name": "bidding_strategy_max_cpc_bid_ceiling", "comment": null}, "bidding_strategy_max_cpc_bid_floor": {"type": "integer", "index": 19, "name": "bidding_strategy_max_cpc_bid_floor", "comment": null}, "bidding_strategy_name": {"type": "integer", "index": 20, "name": "bidding_strategy_name", "comment": null}, "bidding_strategy_raise_bid_when_budget_constrained": {"type": "integer", "index": 21, "name": "bidding_strategy_raise_bid_when_budget_constrained", "comment": null}, "bidding_strategy_raise_bid_when_low_quality_score": {"type": "integer", "index": 22, "name": "bidding_strategy_raise_bid_when_low_quality_score", "comment": null}, "bidding_strategy_scheme_type": {"type": "integer", "index": 23, "name": "bidding_strategy_scheme_type", "comment": null}, "bidding_strategy_source": {"type": "integer", "index": 24, "name": "bidding_strategy_source", "comment": null}, "bidding_strategy_spend_target": {"type": "integer", "index": 25, "name": "bidding_strategy_spend_target", "comment": null}, "bidding_strategy_strategy_goal": {"type": "integer", "index": 26, "name": "bidding_strategy_strategy_goal", "comment": null}, "bidding_strategy_target_cpa": {"type": "integer", "index": 27, "name": "bidding_strategy_target_cpa", "comment": null}, "bidding_strategy_target_outrank_share": {"type": "integer", "index": 28, "name": "bidding_strategy_target_outrank_share", "comment": null}, "bidding_strategy_target_roas": {"type": "integer", "index": 29, "name": "bidding_strategy_target_roas", "comment": null}, "bidding_strategy_target_roas_override": {"type": "integer", "index": 30, "name": "bidding_strategy_target_roas_override", "comment": null}, "bidding_strategy_type": {"type": "text", "index": 31, "name": "bidding_strategy_type", "comment": null}, "bidding_strategy_viewable_cpm_enabled": {"type": "integer", "index": 32, "name": "bidding_strategy_viewable_cpm_enabled", "comment": null}, "campaign_group_id": {"type": "integer", "index": 33, "name": "campaign_group_id", "comment": null}, "campaign_trial_type": {"type": "text", "index": 34, "name": "campaign_trial_type", "comment": null}, "customer_id": {"type": "bigint", "index": 35, "name": "customer_id", "comment": null}, "end_date": {"type": "date", "index": 36, "name": "end_date", "comment": null}, "final_url_suffix": {"type": "integer", "index": 37, "name": "final_url_suffix", "comment": null}, "frequency_cap_impressions": {"type": "integer", "index": 38, "name": "frequency_cap_impressions", "comment": null}, "frequency_cap_level": {"type": "integer", "index": 39, "name": "frequency_cap_level", "comment": null}, "frequency_cap_time_unit": {"type": "integer", "index": 40, "name": "frequency_cap_time_unit", "comment": null}, "network_setting_target_content_network": {"type": "boolean", "index": 41, "name": "network_setting_target_content_network", "comment": null}, "network_setting_target_google_search": {"type": "boolean", "index": 42, "name": "network_setting_target_google_search", "comment": null}, "network_setting_target_partner_search_network": {"type": "boolean", "index": 43, "name": "network_setting_target_partner_search_network", "comment": null}, "network_setting_target_search_network": {"type": "boolean", "index": 44, "name": "network_setting_target_search_network", "comment": null}, "serving_status": {"type": "text", "index": 45, "name": "serving_status", "comment": null}, "start_date": {"type": "date", "index": 46, "name": "start_date", "comment": null}, "status": {"type": "text", "index": 47, "name": "status", "comment": null}, "tracking_url_template": {"type": "integer", "index": 48, "name": "tracking_url_template", "comment": null}, "vanity_pharma_display_url_mode": {"type": "text", "index": 49, "name": "vanity_pharma_display_url_mode", "comment": null}, "vanity_pharma_text": {"type": "text", "index": 50, "name": "vanity_pharma_text", "comment": null}, "name": {"type": "text", "index": 51, "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": "seed.google_ads_integration_tests.google_ads_campaign_history_data"}, "seed.google_ads_integration_tests.google_ads_click_performance_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_click_performance_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "criteria_id": {"type": "bigint", "index": 11, "name": "criteria_id", "comment": null}, "date": {"type": "date", "index": 12, "name": "date", "comment": null}, "external_customer_id": {"type": "bigint", "index": 13, "name": "external_customer_id", "comment": null}, "gcl_id": {"type": "text", "index": 14, "name": "gcl_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": "seed.google_ads_integration_tests.google_ads_click_performance_data"}, "seed.google_ads_integration_tests.google_ads_criteria_performance_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_criteria_performance_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "cost": {"type": "double precision", "index": 11, "name": "cost", "comment": null}, "criteria": {"type": "text", "index": 12, "name": "criteria", "comment": null}, "criteria_destination_url": {"type": "integer", "index": 13, "name": "criteria_destination_url", "comment": null}, "criteria_type": {"type": "text", "index": 14, "name": "criteria_type", "comment": null}, "date": {"type": "date", "index": 15, "name": "date", "comment": null}, "external_customer_id": {"type": "bigint", "index": 16, "name": "external_customer_id", "comment": null}, "id": {"type": "bigint", "index": 17, "name": "id", "comment": null}, "impressions": {"type": "integer", "index": 18, "name": "impressions", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.google_ads_integration_tests.google_ads_criteria_performance_data"}, "seed.google_ads_integration_tests.google_ads_final_url_performance_data": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests", "name": "google_ads_final_url_performance_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "cost": {"type": "double precision", "index": 11, "name": "cost", "comment": null}, "date": {"type": "date", "index": 12, "name": "date", "comment": null}, "effective_final_url": {"type": "text", "index": 13, "name": "effective_final_url", "comment": null}, "external_customer_id": {"type": "bigint", "index": 14, "name": "external_customer_id", "comment": null}, "impressions": {"type": "integer", "index": 15, "name": "impressions", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.google_ads_integration_tests.google_ads_final_url_performance_data"}, "model.google_ads.google_ads__click_performance": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_google_ads", "name": "google_ads__click_performance", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"date_day": {"type": "date", "index": 1, "name": "date_day", "comment": null}, "campaign_id": {"type": "bigint", "index": 2, "name": "campaign_id", "comment": null}, "ad_group_id": {"type": "bigint", "index": 3, "name": "ad_group_id", "comment": null}, "criteria_id": {"type": "bigint", "index": 4, "name": "criteria_id", "comment": null}, "gclid": {"type": "text", "index": 5, "name": "gclid", "comment": null}, "rn": {"type": "bigint", "index": 6, "name": "rn", "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.google_ads.google_ads__click_performance"}, "model.google_ads.google_ads__criteria_ad_adapter": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_google_ads", "name": "google_ads__criteria_ad_adapter", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"date_day": {"type": "date", "index": 1, "name": "date_day", "comment": null}, "account_name": {"type": "text", "index": 2, "name": "account_name", "comment": null}, "external_customer_id": {"type": "bigint", "index": 3, "name": "external_customer_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_id": {"type": "bigint", "index": 5, "name": "campaign_id", "comment": null}, "ad_group_name": {"type": "text", "index": 6, "name": "ad_group_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 7, "name": "ad_group_id", "comment": null}, "criteria": {"type": "text", "index": 8, "name": "criteria", "comment": null}, "criteria_type": {"type": "text", "index": 9, "name": "criteria_type", "comment": null}, "spend": {"type": "double precision", "index": 10, "name": "spend", "comment": null}, "clicks": {"type": "bigint", "index": 11, "name": "clicks", "comment": null}, "impressions": {"type": "bigint", "index": 12, "name": "impressions", "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.google_ads.google_ads__criteria_ad_adapter"}, "model.google_ads.google_ads__url_ad_adapter": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_google_ads", "name": "google_ads__url_ad_adapter", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"date_day": {"type": "date", "index": 1, "name": "date_day", "comment": null}, "account_name": {"type": "integer", "index": 2, "name": "account_name", "comment": null}, "account_id": {"type": "integer", "index": 3, "name": "account_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_id": {"type": "bigint", "index": 5, "name": "campaign_id", "comment": null}, "ad_group_name": {"type": "text", "index": 6, "name": "ad_group_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 7, "name": "ad_group_id", "comment": null}, "base_url": {"type": "text", "index": 8, "name": "base_url", "comment": null}, "url_host": {"type": "character varying", "index": 9, "name": "url_host", "comment": null}, "url_path": {"type": "text", "index": 10, "name": "url_path", "comment": null}, "utm_source": {"type": "text", "index": 11, "name": "utm_source", "comment": null}, "utm_medium": {"type": "text", "index": 12, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "text", "index": 13, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "text", "index": 14, "name": "utm_content", "comment": null}, "utm_term": {"type": "text", "index": 15, "name": "utm_term", "comment": null}, "spend": {"type": "numeric", "index": 16, "name": "spend", "comment": null}, "clicks": {"type": "bigint", "index": 17, "name": "clicks", "comment": null}, "impressions": {"type": "bigint", "index": 18, "name": "impressions", "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.google_ads.google_ads__url_ad_adapter"}, "model.google_ads_source.stg_google_ads__click_performance": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__click_performance", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_name": {"type": "text", "index": 3, "name": "account_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "criteria_id": {"type": "bigint", "index": 11, "name": "criteria_id", "comment": null}, "date_day": {"type": "date", "index": 12, "name": "date_day", "comment": null}, "external_customer_id": {"type": "bigint", "index": 13, "name": "external_customer_id", "comment": null}, "gclid": {"type": "text", "index": 14, "name": "gclid", "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.google_ads_source.stg_google_ads__click_performance"}, "model.google_ads_source.stg_google_ads__click_performance_tmp": {"metadata": {"type": "VIEW", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__click_performance_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "criteria_id": {"type": "bigint", "index": 11, "name": "criteria_id", "comment": null}, "date": {"type": "date", "index": 12, "name": "date", "comment": null}, "external_customer_id": {"type": "bigint", "index": 13, "name": "external_customer_id", "comment": null}, "gcl_id": {"type": "text", "index": 14, "name": "gcl_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.google_ads_source.stg_google_ads__click_performance_tmp"}, "model.google_ads_source.stg_google_ads__criteria_performance": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__criteria_performance", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_name": {"type": "text", "index": 3, "name": "account_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "spend": {"type": "double precision", "index": 11, "name": "spend", "comment": null}, "criteria": {"type": "text", "index": 12, "name": "criteria", "comment": null}, "criteria_destination_url": {"type": "integer", "index": 13, "name": "criteria_destination_url", "comment": null}, "criteria_type": {"type": "text", "index": 14, "name": "criteria_type", "comment": null}, "date_day": {"type": "date", "index": 15, "name": "date_day", "comment": null}, "external_customer_id": {"type": "bigint", "index": 16, "name": "external_customer_id", "comment": null}, "id": {"type": "bigint", "index": 17, "name": "id", "comment": null}, "impressions": {"type": "integer", "index": 18, "name": "impressions", "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.google_ads_source.stg_google_ads__criteria_performance"}, "model.google_ads_source.stg_google_ads__criteria_performance_tmp": {"metadata": {"type": "VIEW", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__criteria_performance_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "cost": {"type": "double precision", "index": 11, "name": "cost", "comment": null}, "criteria": {"type": "text", "index": 12, "name": "criteria", "comment": null}, "criteria_destination_url": {"type": "integer", "index": 13, "name": "criteria_destination_url", "comment": null}, "criteria_type": {"type": "text", "index": 14, "name": "criteria_type", "comment": null}, "date": {"type": "date", "index": 15, "name": "date", "comment": null}, "external_customer_id": {"type": "bigint", "index": 16, "name": "external_customer_id", "comment": null}, "id": {"type": "bigint", "index": 17, "name": "id", "comment": null}, "impressions": {"type": "integer", "index": 18, "name": "impressions", "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.google_ads_source.stg_google_ads__criteria_performance_tmp"}, "model.google_ads_source.stg_google_ads__final_url_performance": {"metadata": {"type": "BASE TABLE", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__final_url_performance", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_name": {"type": "text", "index": 3, "name": "account_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "spend": {"type": "double precision", "index": 11, "name": "spend", "comment": null}, "date_day": {"type": "date", "index": 12, "name": "date_day", "comment": null}, "final_url": {"type": "text", "index": 13, "name": "final_url", "comment": null}, "external_customer_id": {"type": "bigint", "index": 14, "name": "external_customer_id", "comment": null}, "impressions": {"type": "integer", "index": 15, "name": "impressions", "comment": null}, "base_url": {"type": "text", "index": 16, "name": "base_url", "comment": null}, "url_host": {"type": "character varying", "index": 17, "name": "url_host", "comment": null}, "url_path": {"type": "text", "index": 18, "name": "url_path", "comment": null}, "utm_source": {"type": "text", "index": 19, "name": "utm_source", "comment": null}, "utm_medium": {"type": "text", "index": 20, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "text", "index": 21, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "text", "index": 22, "name": "utm_content", "comment": null}, "utm_term": {"type": "text", "index": 23, "name": "utm_term", "comment": null}, "final_url_performance_id": {"type": "text", "index": 24, "name": "final_url_performance_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.google_ads_source.stg_google_ads__final_url_performance"}, "model.google_ads_source.stg_google_ads__final_url_performance_tmp": {"metadata": {"type": "VIEW", "schema": "google_ads_integration_tests_stg_google_ads", "name": "stg_google_ads__final_url_performance_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"_fivetran_id": {"type": "text", "index": 1, "name": "_fivetran_id", "comment": null}, "_fivetran_synced": {"type": "text", "index": 2, "name": "_fivetran_synced", "comment": null}, "account_descriptive_name": {"type": "text", "index": 3, "name": "account_descriptive_name", "comment": null}, "ad_group_id": {"type": "bigint", "index": 4, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "text", "index": 5, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "text", "index": 6, "name": "ad_group_status", "comment": null}, "campaign_id": {"type": "bigint", "index": 7, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "text", "index": 8, "name": "campaign_name", "comment": null}, "campaign_status": {"type": "text", "index": 9, "name": "campaign_status", "comment": null}, "clicks": {"type": "integer", "index": 10, "name": "clicks", "comment": null}, "cost": {"type": "double precision", "index": 11, "name": "cost", "comment": null}, "date": {"type": "date", "index": 12, "name": "date", "comment": null}, "effective_final_url": {"type": "text", "index": 13, "name": "effective_final_url", "comment": null}, "external_customer_id": {"type": "bigint", "index": 14, "name": "external_customer_id", "comment": null}, "impressions": {"type": "integer", "index": 15, "name": "impressions", "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.google_ads_source.stg_google_ads__final_url_performance_tmp"}}, "sources": {}, "errors": null} \ No newline at end of file diff --git a/dbt_packages/google_ads/docs/index.html b/dbt_packages/google_ads/docs/index.html new file mode 100644 index 0000000..0c4d0ec --- /dev/null +++ b/dbt_packages/google_ads/docs/index.html @@ -0,0 +1,102 @@ +<!DOCTYPE html> +<html dir="ltr" lang="en-US" ng-app='dbt' class='no-flash video supports no-touchevents formvalidation webgl no-cssgridlegacy cssgrid cssfilters objectfit object-fit click landscape videoautoplay loaded'> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, initial-scale=1" /> + + <title>dbt Docs + + + + + + + + + + + + + + + + + +
icons
+
+ + diff --git a/dbt_packages/google_ads/docs/manifest.json b/dbt_packages/google_ads/docs/manifest.json new file mode 100644 index 0000000..3950f5b --- /dev/null +++ b/dbt_packages/google_ads/docs/manifest.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.1", "generated_at": "2022-02-04T17:16:49.474131Z", "invocation_id": "eb911fd0-a551-4c69-a36a-f5df3bb4d6e6", "env": {}, "project_id": "768865b5789e0aba6e651c95efd7726c", "user_id": "57178664-37b2-4047-9572-68ec8b488cd7", "send_anonymous_usage_stats": true, "adapter_type": "postgres"}, "nodes": {"seed.google_ads_integration_tests.google_ads_final_url_performance_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"ad_group_id": "bigint", "campaign_id": "bigint", "external_customer_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_final_url_performance_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_final_url_performance_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_final_url_performance_data.csv", "original_file_path": "seeds/google_ads_final_url_performance_data.csv", "name": "google_ads_final_url_performance_data", "alias": "google_ads_final_url_performance_data", "checksum": {"name": "sha256", "checksum": "4019a5fb446bfc6ae476b997a6781315139883926dbab7aadaed5163a22446bc"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"ad_group_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "external_customer_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.9471161, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_final_url_performance_data\""}, "seed.google_ads_integration_tests.google_ads_ad_stats_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"customer_id": "bigint", "ad_id": "bigint", "campaign_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_ad_stats_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_ad_stats_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_ad_stats_data.csv", "original_file_path": "seeds/google_ads_ad_stats_data.csv", "name": "google_ads_ad_stats_data", "alias": "google_ads_ad_stats_data", "checksum": {"name": "sha256", "checksum": "57f977d336374f41000bdce5167f77a877dea7d21f144475dcbaad2c9e407c54"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"customer_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "ad_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.9606788, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_ad_stats_data\""}, "seed.google_ads_integration_tests.google_ads_account_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_account_history_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_account_history_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_account_history_data.csv", "original_file_path": "seeds/google_ads_account_history_data.csv", "name": "google_ads_account_history_data", "alias": "google_ads_account_history_data", "checksum": {"name": "sha256", "checksum": "bf0559a512f089514aa67964b7ae5aef0fee8deb6e0874c01e853ed78dd7883d"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1643994998.963129, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_account_history_data\""}, "seed.google_ads_integration_tests.google_ads_campaign_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"id": "bigint", "base_campaign_id": "bigint", "customer_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_campaign_history_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_campaign_history_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_campaign_history_data.csv", "original_file_path": "seeds/google_ads_campaign_history_data.csv", "name": "google_ads_campaign_history_data", "alias": "google_ads_campaign_history_data", "checksum": {"name": "sha256", "checksum": "82df483d8e75d5ae32ebe80450b4238bb724f61d2ea883c275097d398d5623be"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "base_campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "customer_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.965748, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_campaign_history_data\""}, "seed.google_ads_integration_tests.google_ads_ad_group_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"id": "bigint", "campaign_id": "bigint", "base_ad_group_id": "bigint", "base_campaign_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_ad_group_history_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_ad_group_history_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_ad_group_history_data.csv", "original_file_path": "seeds/google_ads_ad_group_history_data.csv", "name": "google_ads_ad_group_history_data", "alias": "google_ads_ad_group_history_data", "checksum": {"name": "sha256", "checksum": "016b74b30b9c7723887f27134a5ba7ee40e363a316c692c299bc0209e983def5"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "base_ad_group_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "base_campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.96819, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_ad_group_history_data\""}, "seed.google_ads_integration_tests.google_ads_click_performance_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"ad_group_id": "bigint", "campaign_id": "bigint", "criteria_id": "bigint", "external_customer_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_click_performance_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_click_performance_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_click_performance_data.csv", "original_file_path": "seeds/google_ads_click_performance_data.csv", "name": "google_ads_click_performance_data", "alias": "google_ads_click_performance_data", "checksum": {"name": "sha256", "checksum": "bc84e68f0491db936dd981b679f5979e84a093b9ee5d7de30223d0343b326241"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"ad_group_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "criteria_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "external_customer_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.970645, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_click_performance_data\""}, "seed.google_ads_integration_tests.google_ads_ad_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"id": "bigint", "ad_group_id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_ad_history_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_ad_history_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_ad_history_data.csv", "original_file_path": "seeds/google_ads_ad_history_data.csv", "name": "google_ads_ad_history_data", "alias": "google_ads_ad_history_data", "checksum": {"name": "sha256", "checksum": "a4c23fae9da0557efb50a99043b22d19d975068f0d194fcb8bbf6dd3cb80920f"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "ad_group_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.973181, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_ad_history_data\""}, "seed.google_ads_integration_tests.google_ads_criteria_performance_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {"ad_group_id": "bigint", "campaign_id": "bigint", "external_customer_id": "bigint", "id": "bigint"}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests", "fqn": ["google_ads_integration_tests", "google_ads_criteria_performance_data"], "unique_id": "seed.google_ads_integration_tests.google_ads_criteria_performance_data", "package_name": "google_ads_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests", "path": "google_ads_criteria_performance_data.csv", "original_file_path": "seeds/google_ads_criteria_performance_data.csv", "name": "google_ads_criteria_performance_data", "alias": "google_ads_criteria_performance_data", "checksum": {"name": "sha256", "checksum": "54e8418b3580d62dd06a17857ce4b50b741019da0a23497200655b4f7cf322ee"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"column_types": {"ad_group_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "campaign_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "external_customer_id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}", "id": "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"}}, "created_at": 1643994998.975594, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests\".\"google_ads_criteria_performance_data\""}, "model.google_ads.google_ads__click_performance": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith base as (\n\n select *\n from {{ var('click_performance') }}\n\n), fields as (\n\n select\n date_day,\n campaign_id,\n ad_group_id,\n criteria_id,\n gclid,\n row_number() over (partition by gclid order by date_day) as rn\n from base\n\n), filtered as ( -- we've heard that sometimes duplicates gclids are an issue. This dedupe ensures no glcids are double counted.\n\n select *\n from fields\n where gclid is not null \n and rn = 1\n\n)\n\nselect * from filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.google_ads_source.stg_google_ads__click_performance"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_google_ads", "fqn": ["google_ads", "google_ads__click_performance"], "unique_id": "model.google_ads.google_ads__click_performance", "package_name": "google_ads", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads", "path": "google_ads__click_performance.sql", "original_file_path": "models/google_ads__click_performance.sql", "name": "google_ads__click_performance", "alias": "google_ads__click_performance", "checksum": {"name": "sha256", "checksum": "215ddfc8714b2b8dc7125cd2f8893e5c31b87c8c76dab57052411f6c5d448fd4"}, "tags": [], "refs": [["stg_google_ads__click_performance"]], "sources": [], "description": "Each record represents a click, with a unique Google Click ID (gclid).", "columns": {"date_day": {"name": "date_day", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_id": {"name": "criteria_id", "description": "The Criterion ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gclid": {"name": "gclid", "description": "The Google Click ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rn": {"name": "rn", "description": "Row number partitioned by gclid and ordered by date_day which is used to dedupe possible double gclids.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads://models/google_ads.yml", "compiled_path": "target/compiled/google_ads/models/google_ads__click_performance.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.475465, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__click_performance\"\n\n), fields as (\n\n select\n date_day,\n campaign_id,\n ad_group_id,\n criteria_id,\n gclid,\n row_number() over (partition by gclid order by date_day) as rn\n from base\n\n), filtered as ( -- we've heard that sometimes duplicates gclids are an issue. This dedupe ensures no glcids are double counted.\n\n select *\n from fields\n where gclid is not null \n and rn = 1\n\n)\n\nselect * from filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_google_ads\".\"google_ads__click_performance\""}, "model.google_ads.google_ads__url_ad_adapter": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith base as (\n\n select *\n from {{ var('final_url_performance') }}\n\n), fields as (\n\n select\n date_day,\n account_name,\n external_customer_id,\n campaign_name,\n campaign_id,\n ad_group_name,\n ad_group_id,\n base_url,\n url_host,\n url_path,\n utm_source,\n utm_medium,\n utm_campaign,\n utm_content,\n utm_term,\n sum(spend) as spend,\n sum(clicks) as clicks,\n sum(impressions) as impressions\n\n {% for metric in var('google_ads__url_passthrough_metrics') %}\n , sum({{ metric }}) as {{ metric }}\n {% endfor %}\n from base\n {{ dbt_utils.group_by(15) }}\n\n)\n\nselect *\nfrom fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.google_ads_source.stg_google_ads__final_url_performance"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_google_ads", "fqn": ["google_ads", "url_adwords", "google_ads__url_ad_adapter"], "unique_id": "model.google_ads.google_ads__url_ad_adapter", "package_name": "google_ads", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads", "path": "url_adwords/google_ads__url_ad_adapter.sql", "original_file_path": "models/url_adwords/google_ads__url_ad_adapter.sql", "name": "google_ads__url_ad_adapter", "alias": "google_ads__url_ad_adapter", "checksum": {"name": "sha256", "checksum": "b995a6979f6b30f91d9c15dc6eef69f0ea73913147d425d3c89137907b5d6942"}, "tags": [], "refs": [["stg_google_ads__final_url_performance"]], "sources": [], "description": "Each record in this table represents the daily performance of URLs at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria": {"name": "criteria", "description": "Descriptive string for the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_type": {"name": "criteria_type", "description": "The type of the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads://models/google_ads.yml", "compiled_path": "target/compiled/google_ads/models/url_adwords/google_ads__url_ad_adapter.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.4723752, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance\"\n\n), fields as (\n\n select\n date_day,\n account_name,\n external_customer_id,\n campaign_name,\n campaign_id,\n ad_group_name,\n ad_group_id,\n base_url,\n url_host,\n url_path,\n utm_source,\n utm_medium,\n utm_campaign,\n utm_content,\n utm_term,\n sum(spend) as spend,\n sum(clicks) as clicks,\n sum(impressions) as impressions\n\n \n from base\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n\n)\n\nselect *\nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_google_ads\".\"google_ads__url_ad_adapter\""}, "model.google_ads.google_ads__criteria_ad_adapter": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith base as (\n\n select *\n from {{ var('criteria_performance') }}\n\n), fields as (\n\n select\n date_day,\n account_name,\n external_customer_id,\n campaign_name,\n campaign_id,\n ad_group_name,\n ad_group_id,\n criteria, \n criteria_type,\n sum(spend) as spend,\n sum(clicks) as clicks,\n sum(impressions) as impressions\n\n {% for metric in var('google_ads__criteria_passthrough_metrics') %}\n , sum({{ metric }}) as {{ metric }}\n {% endfor %}\n from base\n {{ dbt_utils.group_by(9) }}\n\n)\n\nselect *\nfrom fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.google_ads_source.stg_google_ads__criteria_performance"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_google_ads", "fqn": ["google_ads", "criteria", "google_ads__criteria_ad_adapter"], "unique_id": "model.google_ads.google_ads__criteria_ad_adapter", "package_name": "google_ads", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads", "path": "criteria/google_ads__criteria_ad_adapter.sql", "original_file_path": "models/criteria/google_ads__criteria_ad_adapter.sql", "name": "google_ads__criteria_ad_adapter", "alias": "google_ads__criteria_ad_adapter", "checksum": {"name": "sha256", "checksum": "3530ad48d3f99461aa193dc5c071e37c8a3fcfddf2e0cbd8a0d00f30f7b3bbe5"}, "tags": [], "refs": [["stg_google_ads__criteria_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads/models/criteria/google_ads__criteria_ad_adapter.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.070665, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__criteria_performance\"\n\n), fields as (\n\n select\n date_day,\n account_name,\n external_customer_id,\n campaign_name,\n campaign_id,\n ad_group_name,\n ad_group_id,\n criteria, \n criteria_type,\n sum(spend) as spend,\n sum(clicks) as clicks,\n sum(impressions) as impressions\n\n \n from base\n group by 1,2,3,4,5,6,7,8,9\n\n)\n\nselect *\nfrom fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_google_ads\".\"google_ads__criteria_ad_adapter\""}, "model.google_ads_source.stg_google_ads__final_url_performance": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__final_url_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__final_url_performance_tmp')),\n staging_columns=get_final_url_performance_columns()\n )\n }}\n\n {% for metric in var('google_ads__url_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n\n from source\n\n), \n\nurl_fields as (\n\n select\n *,\n {{ dbt_utils.split_part('final_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('final_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path,\n\n {% if var('google_auto_tagging_enabled', false) %}\n\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} , 'google') as utm_source,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} , 'cpc') as utm_medium,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} , campaign_name) as utm_campaign,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} , ad_group_name) as utm_content,\n\n {% else %}\n\n {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content,\n \n {% endif %}\n \n {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term\n\n from renamed\n\n), surrogate_key as (\n\n select\n *,\n {{ dbt_utils.surrogate_key(['date_day','campaign_id','ad_group_id','final_url']) }} as final_url_performance_id\n from url_fields\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_final_url_performance_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter", "macro.dbt_utils.surrogate_key"], "nodes": ["model.google_ads_source.stg_google_ads__final_url_performance_tmp", "model.google_ads_source.stg_google_ads__final_url_performance_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__final_url_performance"], "unique_id": "model.google_ads_source.stg_google_ads__final_url_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__final_url_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__final_url_performance.sql", "name": "stg_google_ads__final_url_performance", "alias": "stg_google_ads__final_url_performance", "checksum": {"name": "sha256", "checksum": "c355bede9303daf44f6b4336717c4cc1123d9dc1421ebe262b2328fada9227ef"}, "tags": [], "refs": [["stg_google_ads__final_url_performance_tmp"], ["stg_google_ads__final_url_performance_tmp"]], "sources": [], "description": "Each record represents the performance of a final url at the ad group level.", "columns": {"final_url_performance_id": {"name": "final_url_performance_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_url": {"name": "final_url", "description": "Effective final URL of the impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads__final_url_performance.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.573771, "compiled_sql": "\n\nwith source as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance_tmp\"\n\n),\n\nrenamed as (\n\n select\n \n \n \n \n _fivetran_id\n \n as \n \n _fivetran_id\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n account_descriptive_name\n \n as account_name , \n \n \n ad_group_id\n \n as \n \n ad_group_id\n \n, \n \n \n ad_group_name\n \n as \n \n ad_group_name\n \n, \n \n \n ad_group_status\n \n as \n \n ad_group_status\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_status\n \n as \n \n campaign_status\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n cost\n \n as spend , \n \n \n date\n \n as date_day , \n \n \n effective_final_url\n \n as final_url , \n \n \n external_customer_id\n \n as \n \n external_customer_id\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n\n\n\n\n \n\n from source\n\n), \n\nurl_fields as (\n\n select\n *,\n \n\n split_part(\n final_url,\n '?',\n 1\n )\n\n as base_url,\n \n \n cast(\n\n split_part(\n \n\n split_part(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n final_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/',\n 1\n )\n\n,\n '?',\n 1\n )\n\n as \n varchar\n)\n as url_host,\n '/' || \n \n cast(\n\n split_part(\n \n\n right(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n \n \n length(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n position(\n '/' in \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ), 0),\n \n\n position(\n '?' in \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ) - 1\n )\n ),\n '?',\n 1\n )\n\n as \n varchar\n)\n as url_path,\n\n \n\n nullif(\n\n split_part(\n \n\n split_part(\n final_url,\n 'utm_source=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_source,\n nullif(\n\n split_part(\n \n\n split_part(\n final_url,\n 'utm_medium=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_medium,\n nullif(\n\n split_part(\n \n\n split_part(\n final_url,\n 'utm_campaign=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_campaign,\n nullif(\n\n split_part(\n \n\n split_part(\n final_url,\n 'utm_content=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_content,\n \n \n \n nullif(\n\n split_part(\n \n\n split_part(\n final_url,\n 'utm_term=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_term\n\n from renamed\n\n), surrogate_key as (\n\n select\n *,\n md5(cast(coalesce(cast(date_day as \n varchar\n), '') || '-' || coalesce(cast(campaign_id as \n varchar\n), '') || '-' || coalesce(cast(ad_group_id as \n varchar\n), '') || '-' || coalesce(cast(final_url as \n varchar\n), '') as \n varchar\n)) as final_url_performance_id\n from url_fields\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance\""}, "model.google_ads_source.stg_google_ads__criteria_performance": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__criteria_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__criteria_performance_tmp')),\n staging_columns=get_criteria_performance_columns()\n )\n }}\n\n {% for metric in var('google_ads__criteria_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n\n from source\n\n)\n\nselect * from renamed", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_criteria_performance_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__criteria_performance_tmp", "model.google_ads_source.stg_google_ads__criteria_performance_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__criteria_performance"], "unique_id": "model.google_ads_source.stg_google_ads__criteria_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__criteria_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__criteria_performance.sql", "name": "stg_google_ads__criteria_performance", "alias": "stg_google_ads__criteria_performance", "checksum": {"name": "sha256", "checksum": "ab4b1625b4bd0e83fe246493b59d7f5855a010df54504af9bba18bf7235885b8"}, "tags": [], "refs": [["stg_google_ads__criteria_performance_tmp"], ["stg_google_ads__criteria_performance_tmp"]], "sources": [], "description": "The Criteria Performance report includes statistics aggregated at the ad group criteria level, one row per ad group and criteria combination.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria": {"name": "criteria", "description": "Descriptive string for the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_destination_url": {"name": "criteria_destination_url", "description": "Destination URL of the criterion that triggered ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_type": {"name": "criteria_type", "description": "The type of the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "id": {"name": "id", "description": "ID of the main object of this row.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads__criteria_performance.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.563503, "compiled_sql": "\n\nwith source as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__criteria_performance_tmp\"\n\n),\n\nrenamed as (\n\n select\n \n \n \n \n _fivetran_id\n \n as \n \n _fivetran_id\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n account_descriptive_name\n \n as account_name , \n \n \n ad_group_id\n \n as \n \n ad_group_id\n \n, \n \n \n ad_group_name\n \n as \n \n ad_group_name\n \n, \n \n \n ad_group_status\n \n as \n \n ad_group_status\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_status\n \n as \n \n campaign_status\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n cost\n \n as spend , \n \n \n criteria\n \n as \n \n criteria\n \n, \n \n \n criteria_destination_url\n \n as \n \n criteria_destination_url\n \n, \n \n \n criteria_type\n \n as \n \n criteria_type\n \n, \n \n \n date\n \n as date_day , \n \n \n external_customer_id\n \n as \n \n external_customer_id\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n\n\n\n\n \n\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__criteria_performance\""}, "model.google_ads_source.stg_google_ads__click_performance": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__click_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__click_performance_tmp')),\n staging_columns=get_click_performance_columns()\n )\n }}\n\n from source\n\n)\n\nselect * from renamed", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_click_performance_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__click_performance_tmp", "model.google_ads_source.stg_google_ads__click_performance_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__click_performance"], "unique_id": "model.google_ads_source.stg_google_ads__click_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__click_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__click_performance.sql", "name": "stg_google_ads__click_performance", "alias": "stg_google_ads__click_performance", "checksum": {"name": "sha256", "checksum": "6156e79e5cc8fbb4f7800c52d2cbfc93630675f744c3a87a35c7a9c0e24cdf6d"}, "tags": [], "refs": [["stg_google_ads__click_performance_tmp"], ["stg_google_ads__click_performance_tmp"]], "sources": [], "description": "The Click Performance report includes stats aggregated at each click level.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_name": {"name": "account_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_id": {"name": "criteria_id", "description": "The Criterion ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date_day": {"name": "date_day", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gclid": {"name": "gclid", "description": "The Google Click ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads__click_performance.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": true}, "created_at": 1643994999.554641, "compiled_sql": "\n\nwith source as (\n\n select *\n from \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__click_performance_tmp\"\n\n),\n\nrenamed as (\n\n select\n \n \n \n \n _fivetran_id\n \n as \n \n _fivetran_id\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n account_descriptive_name\n \n as account_name , \n \n \n ad_group_id\n \n as \n \n ad_group_id\n \n, \n \n \n ad_group_name\n \n as \n \n ad_group_name\n \n, \n \n \n ad_group_status\n \n as \n \n ad_group_status\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_status\n \n as \n \n campaign_status\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n criteria_id\n \n as \n \n criteria_id\n \n, \n \n \n date\n \n as date_day , \n \n \n external_customer_id\n \n as \n \n external_customer_id\n \n, \n \n \n gcl_id\n \n as gclid \n\n\n\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__click_performance\""}, "model.google_ads_source.stg_google_ads__criteria_performance_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__criteria_performance') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["seed.google_ads_integration_tests.google_ads_criteria_performance_data"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__criteria_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__criteria_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql", "name": "stg_google_ads__criteria_performance_tmp", "alias": "stg_google_ads__criteria_performance_tmp", "checksum": {"name": "sha256", "checksum": "4b602c50e2569f30109a5e00524b941d9f9aa74e7f2e6afb851c9e97aa6ca0be"}, "tags": [], "refs": [["google_ads_criteria_performance_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": true}, "created_at": 1643994999.416707, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"google_ads_integration_tests\".\"google_ads_criteria_performance_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__criteria_performance_tmp\""}, "model.google_ads_source.stg_google_ads__final_url_performance_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__final_url_performance') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["seed.google_ads_integration_tests.google_ads_final_url_performance_data"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__final_url_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__final_url_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql", "name": "stg_google_ads__final_url_performance_tmp", "alias": "stg_google_ads__final_url_performance_tmp", "checksum": {"name": "sha256", "checksum": "4e029c606fcb0642ae29d6ae9add21c37eaf3ba2a3275e1c1bdda62113ea3232"}, "tags": [], "refs": [["google_ads_final_url_performance_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": true}, "created_at": 1643994999.4239, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"google_ads_integration_tests\".\"google_ads_final_url_performance_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance_tmp\""}, "model.google_ads_source.stg_google_ads__click_performance_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__click_performance') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["seed.google_ads_integration_tests.google_ads_click_performance_data"]}, "config": {"enabled": true, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__click_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__click_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql", "name": "stg_google_ads__click_performance_tmp", "alias": "stg_google_ads__click_performance_tmp", "checksum": {"name": "sha256", "checksum": "406f0453e172f001316df965f60044079475b8c05b482d8aefbcc4aa1d57949a"}, "tags": [], "refs": [["google_ads_click_performance_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": true}, "created_at": 1643994999.432118, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"google_ads_integration_tests\".\"google_ads_click_performance_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__click_performance_tmp\""}, "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "gclid", "model": "{{ get_where_subquery(ref('stg_google_ads__click_performance')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.google_ads_source.stg_google_ads__click_performance"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "google_ads_integration_tests_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "not_null_stg_google_ads__click_performance_gclid"], "unique_id": "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "not_null_stg_google_ads__click_performance_gclid.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "not_null_stg_google_ads__click_performance_gclid", "alias": "not_null_stg_google_ads__click_performance_gclid", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__click_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads.yml/not_null_stg_google_ads__click_performance_gclid.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1643994999.583314, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__click_performance\"\nwhere gclid is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "gclid", "file_key_name": "models.stg_google_ads__click_performance"}, "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54\") }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "final_url_performance_id", "model": "{{ get_where_subquery(ref('stg_google_ads__final_url_performance')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.google_ads_source.stg_google_ads__final_url_performance"]}, "config": {"enabled": true, "alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "google_ads_integration_tests_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "unique_stg_google_ads__final_url_performance_final_url_performance_id"], "unique_id": "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "unique_stg_google_ads__final_url_performance_final_url_performance_id", "alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__final_url_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads.yml/unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54"}, "created_at": 1643994999.585836, "compiled_sql": "\n \n \n\nselect\n final_url_performance_id as unique_field,\n count(*) as n_records\n\nfrom \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance\"\nwhere final_url_performance_id is not null\ngroup by final_url_performance_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "final_url_performance_id", "file_key_name": "models.stg_google_ads__final_url_performance"}, "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc\") }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "final_url_performance_id", "model": "{{ get_where_subquery(ref('stg_google_ads__final_url_performance')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.google_ads_source.stg_google_ads__final_url_performance"]}, "config": {"enabled": true, "alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "google_ads_integration_tests_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "not_null_stg_google_ads__final_url_performance_final_url_performance_id"], "unique_id": "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "not_null_stg_google_ads__final_url_performance_final_url_performance_id", "alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__final_url_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/adwords_connector/stg_google_ads.yml/not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc"}, "created_at": 1643994999.588681, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"google_ads_integration_tests_stg_google_ads\".\"stg_google_ads__final_url_performance\"\nwhere final_url_performance_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "final_url_performance_id", "file_key_name": "models.stg_google_ads__final_url_performance"}}, "sources": {"source.google_ads_source.adwords.ad_stats": {"fqn": ["google_ads_source", "adwords", "ad_stats"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.ad_stats", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_stats", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_stats", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents the daily performance of an ad in Google Ads.", "columns": {"customer_id": {"name": "customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group": {"name": "ad_group", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "The ID of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_micros": {"name": "cost_micros", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"ad_stats\"", "created_at": 1643994999.590348}, "source.google_ads_source.adwords.ad_history": {"fqn": ["google_ads_source", "adwords", "ad_history"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.ad_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of an ad in Google Ads.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "id": {"name": "id", "description": "The ID of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the ad in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_urls": {"name": "final_urls", "description": "A list of urls that are used for the ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"ad_history\"", "created_at": 1643994999.590577}, "source.google_ads_source.adwords.ad_group_history": {"fqn": ["google_ads_source", "adwords", "ad_group_history"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.ad_group_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_group_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_group_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of an ad group in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the ad group in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"ad_group_history\"", "created_at": 1643994999.590772}, "source.google_ads_source.adwords.campaign_history": {"fqn": ["google_ads_source", "adwords", "campaign_history"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.campaign_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "campaign_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a campaign in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "customer_id": {"name": "customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"campaign_history\"", "created_at": 1643994999.590955}, "source.google_ads_source.adwords.account_history": {"fqn": ["google_ads_source", "adwords", "account_history"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.account_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "account_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "account_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a historical version of an account in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the Account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency_code": {"name": "currency_code", "description": "The currency of the spend reported.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "descriptive_name": {"name": "descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"account_history\"", "created_at": 1643994999.5911412}, "source.google_ads_source.adwords.final_url_performance": {"fqn": ["google_ads_source", "adwords", "final_url_performance"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.final_url_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "final_url_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "final_url_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents the performance of a final url at the ad group level.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost": {"name": "cost", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "effective_final_url": {"name": "effective_final_url", "description": "Effective final URL of the impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"final_url_performance\"", "created_at": 1643994999.591346}, "source.google_ads_source.adwords.click_performance": {"fqn": ["google_ads_source", "adwords", "click_performance"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.click_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "click_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "click_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "The Click Performance report includes stats aggregated at each click level.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_id": {"name": "criteria_id", "description": "The Criterion ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gcl_id": {"name": "gcl_id", "description": "The Google Click ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"click_performance\"", "created_at": 1643994999.5915499}, "source.google_ads_source.adwords.criteria_performance": {"fqn": ["google_ads_source", "adwords", "criteria_performance"], "database": "postgres", "schema": "adwords", "unique_id": "source.google_ads_source.adwords.criteria_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "criteria_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "criteria_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "The Criteria Performance report includes statistics aggregated at the ad group criteria level, one row per ad group and criteria combination.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost": {"name": "cost", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria": {"name": "criteria", "description": "Descriptive string for the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_destination_url": {"name": "criteria_destination_url", "description": "Destination URL of the criterion that triggered ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_type": {"name": "criteria_type", "description": "The type of the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "id": {"name": "id", "description": "ID of the main object of this row.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"adwords\".\"criteria_performance\"", "created_at": 1643994999.5917609}}, "macros": {"macro.dbt_postgres.postgres__get_catalog": {"unique_id": "macro.dbt_postgres.postgres__get_catalog", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "postgres__get_catalog", "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n\n {%- call statement('catalog', fetch_result=True) -%}\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n\n where (\n {%- for schema in schemas -%}\n upper(sch.nspname) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence in ('p', 'u') -- [p]ermanent table or [u]nlogged table. Exclude [t]emporary tables\n and tbl.relkind in ('r', 'v', 'f', 'p') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table, [m]aterialized view\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5421288}, "macro.dbt_postgres.postgres_get_relations": {"unique_id": "macro.dbt_postgres.postgres_get_relations", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "name": "postgres_get_relations", "macro_sql": "{% macro postgres_get_relations () -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.543524}, "macro.dbt_postgres.postgres__create_table_as": {"unique_id": "macro.dbt_postgres.postgres__create_table_as", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_table_as", "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.553728}, "macro.dbt_postgres.postgres__get_create_index_sql": {"unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_create_index_sql", "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.555135}, "macro.dbt_postgres.postgres__create_schema": {"unique_id": "macro.dbt_postgres.postgres__create_schema", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_schema", "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.556951}, "macro.dbt_postgres.postgres__drop_schema": {"unique_id": "macro.dbt_postgres.postgres__drop_schema", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__drop_schema", "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.558312}, "macro.dbt_postgres.postgres__get_columns_in_relation": {"unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_columns_in_relation", "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.sql_convert_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5596879}, "macro.dbt_postgres.postgres__list_relations_without_caching": {"unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_relations_without_caching", "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5609019}, "macro.dbt_postgres.postgres__information_schema_name": {"unique_id": "macro.dbt_postgres.postgres__information_schema_name", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__information_schema_name", "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.561416}, "macro.dbt_postgres.postgres__list_schemas": {"unique_id": "macro.dbt_postgres.postgres__list_schemas", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_schemas", "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5624928}, "macro.dbt_postgres.postgres__check_schema_exists": {"unique_id": "macro.dbt_postgres.postgres__check_schema_exists", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__check_schema_exists", "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.56371}, "macro.dbt_postgres.postgres__current_timestamp": {"unique_id": "macro.dbt_postgres.postgres__current_timestamp", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__current_timestamp", "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.563951}, "macro.dbt_postgres.postgres__snapshot_string_as_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_string_as_time", "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.564498}, "macro.dbt_postgres.postgres__snapshot_get_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_get_time", "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5648189}, "macro.dbt_postgres.postgres__make_temp_relation": {"unique_id": "macro.dbt_postgres.postgres__make_temp_relation", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__make_temp_relation", "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix_length = suffix|length + dtstring|length %}\n {% set relation_max_name_length = 63 %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Temp relation suffix is too long (' ~ suffix|length ~ ' characters). Maximum length is ' ~ (relation_max_name_length - dtstring|length) ~ ' characters.') %}\n {% endif %}\n {% set tmp_identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix ~ dtstring %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.5675368}, "macro.dbt_postgres.postgres_escape_comment": {"unique_id": "macro.dbt_postgres.postgres_escape_comment", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres_escape_comment", "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.56883}, "macro.dbt_postgres.postgres__alter_relation_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_relation_comment", "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.569512}, "macro.dbt_postgres.postgres__alter_column_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_column_comment", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_column_comment", "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in column_dict if (column_name in existing_columns) %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.571349}, "macro.dbt_postgres.postgres__snapshot_merge_sql": {"unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", "package_name": "dbt_postgres", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/postgres", "path": "macros/materializations/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot_merge.sql", "name": "postgres__snapshot_merge_sql", "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.57373}, "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/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": 1643994997.576766}, "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/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": 1643994997.577347}, "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/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": 1643994997.5777779}, "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/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": 1643994997.578215}, "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/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": 1643994997.578649}, "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/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": 1643994997.5797791}, "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/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": 1643994997.580689}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.5819478}, "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/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.583189}, "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/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": 1643994997.5839841}, "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/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": 1643994997.592108}, "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/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.592604}, "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/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": 1643994997.59327}, "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/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.593697}, "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/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": 1643994997.593984}, "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/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": 1643994997.596218}, "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/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.596726}, "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/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": 1643994997.597328}, "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/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": 1643994997.60058}, "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/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": 1643994997.6067681}, "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/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.6130261}, "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/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": 1643994997.6139169}, "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/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.614431}, "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/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": 1643994997.6147032}, "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/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": 1643994997.615463}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.618145}, "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/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": 1643994997.618762}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.619564}, "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/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": 1643994997.620951}, "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/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": 1643994997.636112}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_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/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": 1643994997.642334}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_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/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": 1643994997.643761}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.6448588}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.6461}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.647292}, "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/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": 1643994997.6497831}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_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/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": 1643994997.651819}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.653941}, "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/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": 1643994997.6595972}, "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/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": 1643994997.663224}, "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/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": 1643994997.6640708}, "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/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": 1643994997.665536}, "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/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": 1643994997.6663811}, "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/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": 1643994997.668412}, "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/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": 1643994997.670461}, "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/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": 1643994997.684051}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.693693}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.697559}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.701579}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.7039208}, "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/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": 1643994997.713871}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.715361}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.71606}, "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/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.716768}, "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/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": 1643994997.718144}, "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/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": 1643994997.727467}, "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/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.728582}, "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/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": 1643994997.729273}, "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/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": 1643994997.733302}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.734503}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.734997}, "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/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.7355468}, "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/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": 1643994997.7363431}, "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/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": 1643994997.744428}, "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/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.7522979}, "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/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": 1643994997.755145}, "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/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.755865}, "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/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": 1643994997.757406}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.7578628}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.7583392}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.7588532}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.759216}, "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/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": 1643994997.760683}, "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/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.761246}, "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/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": 1643994997.765005}, "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/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": 1643994997.76642}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.767125}, "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/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": 1643994997.768587}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.769375}, "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/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": 1643994997.7702432}, "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/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": 1643994997.771569}, "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/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": 1643994997.772341}, "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/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": 1643994997.773485}, "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/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": 1643994997.774404}, "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/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": 1643994997.77532}, "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/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": 1643994997.777219}, "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/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": 1643994997.780425}, "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/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": 1643994997.782633}, "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/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": 1643994997.783562}, "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": [], "created_at": 1643994997.787901}, "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": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.7919202}, "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": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.794222}, "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": [], "created_at": 1643994997.794932}, "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/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.796128}, "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/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": 1643994997.796694}, "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/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.797305}, "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/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": 1643994997.797983}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.799553}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.80005}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.800544}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.8017778}, "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/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.80548}, "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/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": 1643994997.8067782}, "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/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.807351}, "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/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": 1643994997.808018}, "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/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": 1643994997.808576}, "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/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": 1643994997.809071}, "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/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.809846}, "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/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": 1643994997.810712}, "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/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": 1643994997.811467}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.81315}, "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/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": 1643994997.813843}, "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/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": 1643994997.8144362}, "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/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.816052}, "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/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": 1643994997.81657}, "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/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": 1643994997.817272}, "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/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": 1643994997.818557}, "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/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.82037}, "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/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": 1643994997.820948}, "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/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8216069}, "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/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": 1643994997.822392}, "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/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8232582}, "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/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": 1643994997.824762}, "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/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.827896}, "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/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": 1643994997.828694}, "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/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.829271}, "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/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": 1643994997.829749}, "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/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8303108}, "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/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": 1643994997.831077}, "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/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8320608}, "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/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": 1643994997.833205}, "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/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8337831}, "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/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": 1643994997.834282}, "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/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.838068}, "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/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": 1643994997.838701}, "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/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": 1643994997.8397162}, "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/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": 1643994997.840322}, "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/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": 1643994997.841364}, "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/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8420649}, "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/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": 1643994997.843908}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.844687}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1643994997.8472278}, "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": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.848992}, "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": "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": 1643994997.849778}, "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": "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": 1643994997.8507562}, "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": "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": 1643994997.851684}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.852619}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.852849}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.853072}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.854178}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.854701}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.855668}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.856071}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.857821}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8582242}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.858458}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8586812}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.858901}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.859391}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.859634}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.859854}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.860335}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.860558}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8607721}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8612502}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.861475}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.86169}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8623612}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.862599}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8628218}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.863301}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.863528}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.863745}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.865404}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.866464}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.866813}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.867141}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.868685}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.869598}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.870247}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8707561}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8713448}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.872294}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8725278}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.87275}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.874191}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8745978}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.875061}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8755279}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8806999}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8812}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) %}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.881721}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8870242}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) %}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.887636}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.888832}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8892548}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.889641}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.890023}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.890977}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.891396}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.891781}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.892755}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.893182}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8935559}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.89511}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.895443}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8957639}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.896874}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.89728}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8976798}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.898548}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.8988538}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.900258}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.900602}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9008179}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.901033}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.901651}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.901985}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.902501}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.902843}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.903241}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.90623}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9076118}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.908979}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.909552}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.911154}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9119449}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.912383}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.913544}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9140701}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.915359}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.915853}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n 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": 1643994997.916425}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.917483}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) %}\n date_trunc('{{datepart}}', {{date}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.918166}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) %}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.918587}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.920952}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.931869}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.933707}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.934658}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.936149}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9516969}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9529338}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.954344}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.955847}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.957917}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.958986}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9599419}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.960842}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.961333}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.962276}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.962867}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.963755}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.964272}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994997.9659362}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9672918}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9679098}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9689999}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9698172}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.971491}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.972461}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9737291}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9748852}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.975939}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.976437}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9780009}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9793549}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.980698}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.981913}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.983189}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.983649}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.984596}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.985065}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.986485}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.9882529}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.990221}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.991204}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.992479}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.993276}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.994362}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.995882}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.997368}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994997.999243}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.0004559}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.0009081}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.0025191}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.004879}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.010491}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.01477}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0169542}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.018563}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0191932}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n/*\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": 1643994998.0201468}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.021127}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.022072}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.024117}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.02641}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.028119}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0292711}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.029792}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.031373}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.033041}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0355}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.036696}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.037492}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.039402}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set 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": 1643994998.04243}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0458891}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0517912}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\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": 1643994998.054871}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\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": 1643994998.061877}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.063026}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0636952}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.065325}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.067795}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.068896}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.069775}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.070739}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.07168}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0747619}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n 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": 1643994998.0754108}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n 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": 1643994998.077257}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.078625}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\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": 1643994998.081433}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\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": 1643994998.086973}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.089802}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for 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": 1643994998.092387}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0936792}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.0955079}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.097808}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.098691}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.100416}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.102855}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1135428}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.115915}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.11883}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.121105}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.123329}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.126063}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1268191}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.127312}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.134263}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.14928}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.149778}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1499789}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.151664}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1555278}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1564329}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.157274}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.158004}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.158928}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.159481}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.160173}, "macro.google_ads_source.get_ad_group_history_columns": {"unique_id": "macro.google_ads_source.get_ad_group_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_rotation_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"base_ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_custom_bid_dimension\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"explorer_auto_optimizer_setting_opt_in\", \"datatype\": \"boolean\"},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"target_restrictions\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"type\", \"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": 1643994998.164581}, "macro.google_ads_source.get_campaign_history_columns": {"unique_id": "macro.google_ads_source.get_campaign_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_serving_optimization_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertising_channel_subtype\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertising_channel_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"base_campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"end_date\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"experiment_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency_caps\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"optimization_score\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"payment_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"serving_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"start_date\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"vanity_pharma_display_url_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"vanity_pharma_text\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"video_brand_safety_suitability\", \"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", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.171455}, "macro.google_ads_source.get_ad_stats_columns": {"unique_id": "macro.google_ads_source.get_ad_stats_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_ad_stats_columns.sql", "original_file_path": "macros/get_ad_stats_columns.sql", "name": "get_ad_stats_columns", "macro_sql": "{% macro get_ad_stats_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active_view_impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_measurability\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"active_view_measurable_cost_micros\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_measurable_impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_viewability\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ad_group\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_base_ad_group\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_network_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_base_campaign\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"conversions\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"conversions_value\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_micros\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"date\", \"datatype\": \"date\"},\n {\"name\": \"device\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"interaction_event_types\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"interactions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"keyword_ad_group_criterion\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"view_through_conversions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.1787908}, "macro.google_ads_source.get_ad_final_url_history_columns": {"unique_id": "macro.google_ads_source.get_ad_final_url_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_ad_final_url_history_columns.sql", "original_file_path": "macros/get_ad_final_url_history_columns.sql", "name": "get_ad_final_url_history_columns", "macro_sql": "{% macro get_ad_final_url_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"sequence_id\", \"datatype\": dbt_utils.type_int()},\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": 1643994998.1810439}, "macro.google_ads_source.get_account_history_columns": {"unique_id": "macro.google_ads_source.get_account_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_account_history_columns.sql", "original_file_path": "macros/get_account_history_columns.sql", "name": "get_account_history_columns", "macro_sql": "{% macro get_account_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"auto_tagging_enabled\", \"datatype\": \"boolean\"},\n {\"name\": \"currency_code\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"descriptive_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"hidden\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"manager\", \"datatype\": \"boolean\"},\n {\"name\": \"manager_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"optimization_score\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"pay_per_conversion_eligibility_failure_reasons\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"test_account\", \"datatype\": \"boolean\"},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"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", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.185591}, "macro.google_ads_source.get_ad_history_columns": {"unique_id": "macro.google_ads_source.get_ad_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"action_items\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_strength\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"added_by_google_ads\", \"datatype\": \"boolean\"},\n {\"name\": \"device_preference\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_app_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_mobile_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"policy_summary_approval_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"policy_summary_review_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_managed_resource_source\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url_collections\", \"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": 1643994998.191781}, "macro.google_ads_source.get_final_url_performance_columns": {"unique_id": "macro.google_ads_source.get_final_url_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_final_url_performance_columns", "macro_sql": "{% macro get_final_url_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"cost\", \"datatype\": dbt_utils.type_float(), \"alias\": \"spend\"},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"effective_final_url\", \"datatype\": dbt_utils.type_string(), \"alias\": \"final_url\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"impressions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.199968}, "macro.google_ads_source.get_click_performance_columns": {"unique_id": "macro.google_ads_source.get_click_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_click_performance_columns", "macro_sql": "{% macro get_click_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"criteria_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"gcl_id\", \"datatype\": dbt_utils.type_string(), \"alias\": \"gclid\"}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.204861}, "macro.google_ads_source.get_criteria_performance_columns": {"unique_id": "macro.google_ads_source.get_criteria_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_criteria_performance_columns", "macro_sql": "{% macro get_criteria_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"cost\", \"datatype\": dbt_utils.type_float(), \"alias\": \"spend\"},\n {\"name\": \"criteria\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"criteria_destination_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"criteria_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"impressions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.209352}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.210979}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.21288}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2133172}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2137449}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.214169}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2145898}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.215013}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.216213}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\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": 1643994998.2174149}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.219702}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.220479}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.22115}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2218099}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2225401}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2233129}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.224618}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.225659}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2259278}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.22619}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.22645}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.227504}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2292538}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2310221}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.232193}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.232552}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.232932}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.233409}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.233963}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.239497}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2400022}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.240492}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2409668}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.24653}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.2509592}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.252435}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.25419}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2556212}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2562509}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.256949}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.257919}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2605171}, "macro.fivetran_utils.staging_models_automation": {"unique_id": "macro.fivetran_utils.staging_models_automation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.26481}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2751691}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.276335}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.27784}, "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/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.2804961}, "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/GoogleAds/dbt_google_ads/integration_tests/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": 1643994998.281873}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/get_columns_for_macro.sql", "original_file_path": "macros/get_columns_for_macro.sql", "name": "get_columns_for_macro", "macro_sql": "{% macro get_columns_for_macro(table_name, schema_name, database_name) -%}\n {{ return(adapter.dispatch('get_columns_for_macro')(table_name, schema_name, database_name)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__get_columns_for_macro"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.282503}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.286411}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.288214}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2897458}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.290219}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.290823}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.291444}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.291959}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.292434}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.294206}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.297225}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.298948}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.2995179}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.3000221}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.300523}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.301007}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.3015292}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.302484}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.302819}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.303294}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.305465}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.308678}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.318775}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.32522}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.326985}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.327471}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.3281012}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.330487}, "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/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1643994998.333782}}, "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 `--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"}, "google_ads_source._fivetran_id": {"unique_id": "google_ads_source._fivetran_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "_fivetran_id", "block_contents": "Unique ID used by Fivetran to sync and dedupe data."}, "google_ads_source._fivetran_synced": {"unique_id": "google_ads_source._fivetran_synced", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "_fivetran_synced", "block_contents": "Timestamp of when a record was last synced."}, "google_ads_source.account_descriptive_name": {"unique_id": "google_ads_source.account_descriptive_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "account_descriptive_name", "block_contents": "The descriptive name of the Customer account."}, "google_ads_source.ad_group_id": {"unique_id": "google_ads_source.ad_group_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_id", "block_contents": "The ID of the AdGroup."}, "google_ads_source.ad_group_name": {"unique_id": "google_ads_source.ad_group_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_name", "block_contents": "The name of the AdGroup."}, "google_ads_source.ad_group_status": {"unique_id": "google_ads_source.ad_group_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_status", "block_contents": "Status of the ad group."}, "google_ads_source.campaign_id": {"unique_id": "google_ads_source.campaign_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_id", "block_contents": "The ID of the Campaign."}, "google_ads_source.ad_id": {"unique_id": "google_ads_source.ad_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_id", "block_contents": "The ID of the Ad."}, "google_ads_source.account_id": {"unique_id": "google_ads_source.account_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "account_id", "block_contents": "The ID of the Account."}, "google_ads_source.ad_status": {"unique_id": "google_ads_source.ad_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_status", "block_contents": "Status of the Ad."}, "google_ads_source.campaign_name": {"unique_id": "google_ads_source.campaign_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_name", "block_contents": "The name of the Campaign."}, "google_ads_source.campaign_status": {"unique_id": "google_ads_source.campaign_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_status", "block_contents": "Status of the Campaign."}, "google_ads_source.clicks": {"unique_id": "google_ads_source.clicks", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "clicks", "block_contents": "The number of clicks."}, "google_ads_source.cost": {"unique_id": "google_ads_source.cost", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "cost", "block_contents": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period."}, "google_ads_source.date": {"unique_id": "google_ads_source.date", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "date", "block_contents": "The date being reported on."}, "google_ads_source.effective_final_url": {"unique_id": "google_ads_source.effective_final_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "effective_final_url", "block_contents": "Effective final URL of the impressions."}, "google_ads_source.external_customer_id": {"unique_id": "google_ads_source.external_customer_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "external_customer_id", "block_contents": "The Customer ID."}, "google_ads_source.impressions": {"unique_id": "google_ads_source.impressions", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "impressions", "block_contents": "Count of how often your ad has appeared on a search results page or website on the Google Network."}, "google_ads_source.criteria_id": {"unique_id": "google_ads_source.criteria_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_id", "block_contents": "The Criterion ID."}, "google_ads_source.gcl_id": {"unique_id": "google_ads_source.gcl_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "gcl_id", "block_contents": "The Google Click ID."}, "google_ads_source.criteria": {"unique_id": "google_ads_source.criteria", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria", "block_contents": "Descriptive string for the Criterion."}, "google_ads_source.criteria_destination_url": {"unique_id": "google_ads_source.criteria_destination_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_destination_url", "block_contents": "Destination URL of the criterion that triggered ads."}, "google_ads_source.criteria_type": {"unique_id": "google_ads_source.criteria_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_type", "block_contents": "The type of the Criterion."}, "google_ads_source.base_url": {"unique_id": "google_ads_source.base_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "base_url", "block_contents": "The base URL of the ad, extracted from the `effective_final_url`."}, "google_ads_source.url_host": {"unique_id": "google_ads_source.url_host", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "url_host", "block_contents": "The URL host of the ad, extracted from the `effective_final_url`."}, "google_ads_source.url_path": {"unique_id": "google_ads_source.url_path", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "url_path", "block_contents": "The URL path of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_source": {"unique_id": "google_ads_source.utm_source", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_source", "block_contents": "The utm_source parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_medium": {"unique_id": "google_ads_source.utm_medium", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_medium", "block_contents": "The utm_medium parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_campaign": {"unique_id": "google_ads_source.utm_campaign", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_campaign", "block_contents": "The utm_campaign parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_content": {"unique_id": "google_ads_source.utm_content", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_content", "block_contents": "The utm_content parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_term": {"unique_id": "google_ads_source.utm_term", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_term", "block_contents": "The utm_term parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.updated_at": {"unique_id": "google_ads_source.updated_at", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "updated_at", "block_contents": "Timestamp of when the record was last updated in Google Ads."}, "google_ads_source.ad_type": {"unique_id": "google_ads_source.ad_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_type", "block_contents": "The type of the ad in Google Ads."}, "google_ads_source.ad_group_type": {"unique_id": "google_ads_source.ad_group_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_type", "block_contents": "The type of the ad group in Google Ads."}, "google_ads_source.is_most_recent_record": {"unique_id": "google_ads_source.is_most_recent_record", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "is_most_recent_record", "block_contents": "Boolean representing whether the record is the most recent version of the object."}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {"model.google_ads.google_ads__url_ad_adapter": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith stats as (\n\n select *\n from {{ var('ad_stats') }}\n\n), accounts as (\n\n select *\n from {{ var('account_history') }}\n where is_most_recent_record = True\n \n), campaigns as (\n\n select *\n from {{ var('campaign_history') }}\n where is_most_recent_record = True\n \n), ad_groups as (\n\n select *\n from {{ var('ad_group_history') }}\n where is_most_recent_record = True\n \n), ads as (\n\n select *\n from {{ var('ad_history') }}\n where is_most_recent_record = True\n \n), fields as (\n\n select\n stats.date_day,\n accounts.account_name,\n accounts.account_id,\n campaigns.campaign_name,\n campaigns.campaign_id,\n ad_groups.ad_group_name,\n ad_groups.ad_group_id,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n sum(stats.spend) as spend,\n sum(stats.clicks) as clicks,\n sum(stats.impressions) as impressions\n\n {% for metric in var('google_ads__ad_stats_passthrough_metrics') %}\n , sum(stats.{{ metric }}) as {{ metric }}\n {% endfor %}\n\n from stats\n left join ads\n on stats.ad_id = ads.ad_id\n left join ad_groups\n on ads.ad_group_id = ad_groups.ad_group_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n left join accounts\n on campaigns.account_id = accounts.account_id\n {{ dbt_utils.group_by(15) }}\n\n)\n\nselect *\nfrom fields", "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_google_ads", "fqn": ["google_ads", "url_google_ads", "google_ads__url_ad_adapter"], "unique_id": "model.google_ads.google_ads__url_ad_adapter", "package_name": "google_ads", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads", "path": "url_google_ads/google_ads__url_ad_adapter.sql", "original_file_path": "models/url_google_ads/google_ads__url_ad_adapter.sql", "name": "google_ads__url_ad_adapter", "alias": "google_ads__url_ad_adapter", "checksum": {"name": "sha256", "checksum": "eeaaa5aca19ff1a2e338b247d0f0198a9c0544a700b61e3a75c89a4d75e23daf"}, "tags": [], "refs": [["stg_google_ads__ad_stats"], ["stg_google_ads__account_history"], ["stg_google_ads__campaign_history"], ["stg_google_ads__ad_group_history"], ["stg_google_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.081627}], "model.google_ads_source.stg_google_ads__ad_group_history": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_group_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ad_group_id,\n updated_at as updated_timestamp,\n _fivetran_synced, \n type as ad_group_type, \n campaign_id, \n campaign_name, \n name as ad_group_name, \n status as ad_group_status\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_group_history"], "unique_id": "model.google_ads_source.stg_google_ads__ad_group_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_group_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_group_history.sql", "name": "stg_google_ads__ad_group_history", "alias": "stg_google_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "ce996ca707c9b4e15a8aff038c34b232aa8a72ad9af28d3490441668925d0dd2"}, "tags": [], "refs": [["stg_google_ads__ad_group_history_tmp"], ["stg_google_ads__ad_group_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.1165152}], "model.google_ads_source.stg_google_ads__ad_history": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ad_group_id, \n id as ad_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n type as ad_type,\n status as ad_status,\n replace(replace(final_urls, '[', ''),']','') as final_urls\n from fields\n),\n\nmost_recent as (\n\n select \n ad_group_id,\n ad_id,\n updated_timestamp,\n _fivetran_synced,\n ad_type,\n ad_status,\n\n --Extract the first url within the list of urls provided within the final_urls field\n {{ dbt_utils.split_part(string_text='final_urls', delimiter_text=\"','\", part_number=1) }} as final_url,\n\n row_number() over (partition by ad_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n),\n\nurl_fields as (\n select \n *,\n {{ dbt_utils.split_part('final_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('final_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term\n from most_recent\n)\n\nselect * \nfrom url_fields", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_history"], "unique_id": "model.google_ads_source.stg_google_ads__ad_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_history.sql", "name": "stg_google_ads__ad_history", "alias": "stg_google_ads__ad_history", "checksum": {"name": "sha256", "checksum": "549a8167dc79c41680fb30d991e29eee3e69d1f49fc5521f908067579b5fd541"}, "tags": [], "refs": [["stg_google_ads__ad_history_tmp"], ["stg_google_ads__ad_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.15585}], "model.google_ads_source.stg_google_ads__ad_stats": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_stats_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_google_ads__ad_stats_tmp')),\n staging_columns=get_ad_stats_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n customer_id as account_id, \n date as date_day, \n ad_group as ad_group_id, \n ad_id, \n campaign_id, \n clicks, \n cost_micros / 1000000.0 as spend, \n impressions\n \n {% for metric in var('google_ads__ad_stats_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect * from final", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_stats_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_stats"], "unique_id": "model.google_ads_source.stg_google_ads__ad_stats", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_stats.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_stats.sql", "name": "stg_google_ads__ad_stats", "alias": "stg_google_ads__ad_stats", "checksum": {"name": "sha256", "checksum": "8a6c0e4a03004d0e315ff747eda962f58cbe6d2eb264c434e51ddf079093eb54"}, "tags": [], "refs": [["stg_google_ads__ad_stats_tmp"], ["stg_google_ads__ad_stats_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.220875}], "model.google_ads_source.stg_google_ads__campaign_history": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__campaign_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as campaign_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n name as campaign_name,\n customer_id as account_id\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__campaign_history"], "unique_id": "model.google_ads_source.stg_google_ads__campaign_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__campaign_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__campaign_history.sql", "name": "stg_google_ads__campaign_history", "alias": "stg_google_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "5d7d9f749113729b95686d5f4a10be5a03bcaceb49dcc1d8010ea4de9812bb49"}, "tags": [], "refs": [["stg_google_ads__campaign_history_tmp"], ["stg_google_ads__campaign_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.249048}], "model.google_ads_source.stg_google_ads__account_history": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__account_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__account_history_tmp')),\n staging_columns=get_account_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as account_id,\n updated_at,\n _fivetran_synced,\n currency_code, \n descriptive_name as account_name\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by account_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_account_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__account_history"], "unique_id": "model.google_ads_source.stg_google_ads__account_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__account_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__account_history.sql", "name": "stg_google_ads__account_history", "alias": "stg_google_ads__account_history", "checksum": {"name": "sha256", "checksum": "aac9a6170b8904d594a4dfba42cf066227bd310a9519fc7fb571962f9a99ceae"}, "tags": [], "refs": [["stg_google_ads__account_history_tmp"], ["stg_google_ads__account_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "table", "enabled": false}, "created_at": 1643994999.2731788}], "model.google_ads_source.stg_google_ads__ad_group_history_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_group_history') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_group_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_group_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql", "name": "stg_google_ads__ad_group_history_tmp", "alias": "stg_google_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "f589c8924b0bfbeb75128808090adfc09fbced5b2da9e6db4d9d6f3608dca284"}, "tags": [], "refs": [["google_ads_ad_group_history_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": false}, "created_at": 1643994999.29023}], "model.google_ads_source.stg_google_ads__ad_stats_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_stats') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_stats_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_stats_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql", "name": "stg_google_ads__ad_stats_tmp", "alias": "stg_google_ads__ad_stats_tmp", "checksum": {"name": "sha256", "checksum": "5bbb33a86167f2b5eec66dcef0da5a3157a971a0af09044a64764de3e0267906"}, "tags": [], "refs": [["google_ads_ad_stats_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": false}, "created_at": 1643994999.297545}], "model.google_ads_source.stg_google_ads__campaign_history_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__campaign_history') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__campaign_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__campaign_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql", "name": "stg_google_ads__campaign_history_tmp", "alias": "stg_google_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "31b88fc1c807181e3fe97c57a0e67fe0455b547fb88acfc1da34fe26773f85ce"}, "tags": [], "refs": [["google_ads_campaign_history_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": false}, "created_at": 1643994999.304559}], "model.google_ads_source.stg_google_ads__ad_history_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_history') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql", "name": "stg_google_ads__ad_history_tmp", "alias": "stg_google_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "9133f01179a6c9c6ccebf38c91c01b926a62ff417bdc642e590feba064bb2fcf"}, "tags": [], "refs": [["google_ads_ad_history_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": false}, "created_at": 1643994999.3116632}], "model.google_ads_source.stg_google_ads__account_history_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__account_history') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "stg_google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "google_ads_integration_tests_stg_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__account_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__account_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/dbt_google_ads/integration_tests/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql", "name": "stg_google_ads__account_history_tmp", "alias": "stg_google_ads__account_history_tmp", "checksum": {"name": "sha256", "checksum": "6023f8a1ab327d732f70c9d716599e00a9f535db622a3a58a04c333586d767d5"}, "tags": [], "refs": [["google_ads_account_history_data"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "stg_google_ads", "materialized": "view", "enabled": false}, "created_at": 1643994999.3185349}]}, "parent_map": {"seed.google_ads_integration_tests.google_ads_final_url_performance_data": [], "seed.google_ads_integration_tests.google_ads_ad_stats_data": [], "seed.google_ads_integration_tests.google_ads_account_history_data": [], "seed.google_ads_integration_tests.google_ads_campaign_history_data": [], "seed.google_ads_integration_tests.google_ads_ad_group_history_data": [], "seed.google_ads_integration_tests.google_ads_click_performance_data": [], "seed.google_ads_integration_tests.google_ads_ad_history_data": [], "seed.google_ads_integration_tests.google_ads_criteria_performance_data": [], "model.google_ads.google_ads__click_performance": ["model.google_ads_source.stg_google_ads__click_performance"], "model.google_ads.google_ads__url_ad_adapter": ["model.google_ads_source.stg_google_ads__final_url_performance"], "model.google_ads.google_ads__criteria_ad_adapter": ["model.google_ads_source.stg_google_ads__criteria_performance"], "model.google_ads_source.stg_google_ads__final_url_performance": ["model.google_ads_source.stg_google_ads__final_url_performance_tmp", "model.google_ads_source.stg_google_ads__final_url_performance_tmp"], "model.google_ads_source.stg_google_ads__criteria_performance": ["model.google_ads_source.stg_google_ads__criteria_performance_tmp", "model.google_ads_source.stg_google_ads__criteria_performance_tmp"], "model.google_ads_source.stg_google_ads__click_performance": ["model.google_ads_source.stg_google_ads__click_performance_tmp", "model.google_ads_source.stg_google_ads__click_performance_tmp"], "model.google_ads_source.stg_google_ads__criteria_performance_tmp": ["seed.google_ads_integration_tests.google_ads_criteria_performance_data"], "model.google_ads_source.stg_google_ads__final_url_performance_tmp": ["seed.google_ads_integration_tests.google_ads_final_url_performance_data"], "model.google_ads_source.stg_google_ads__click_performance_tmp": ["seed.google_ads_integration_tests.google_ads_click_performance_data"], "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": ["model.google_ads_source.stg_google_ads__click_performance"], "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": ["model.google_ads_source.stg_google_ads__final_url_performance"], "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": ["model.google_ads_source.stg_google_ads__final_url_performance"], "source.google_ads_source.adwords.ad_stats": [], "source.google_ads_source.adwords.ad_history": [], "source.google_ads_source.adwords.ad_group_history": [], "source.google_ads_source.adwords.campaign_history": [], "source.google_ads_source.adwords.account_history": [], "source.google_ads_source.adwords.final_url_performance": [], "source.google_ads_source.adwords.click_performance": [], "source.google_ads_source.adwords.criteria_performance": []}, "child_map": {"seed.google_ads_integration_tests.google_ads_final_url_performance_data": ["model.google_ads_source.stg_google_ads__final_url_performance_tmp"], "seed.google_ads_integration_tests.google_ads_ad_stats_data": [], "seed.google_ads_integration_tests.google_ads_account_history_data": [], "seed.google_ads_integration_tests.google_ads_campaign_history_data": [], "seed.google_ads_integration_tests.google_ads_ad_group_history_data": [], "seed.google_ads_integration_tests.google_ads_click_performance_data": ["model.google_ads_source.stg_google_ads__click_performance_tmp"], "seed.google_ads_integration_tests.google_ads_ad_history_data": [], "seed.google_ads_integration_tests.google_ads_criteria_performance_data": ["model.google_ads_source.stg_google_ads__criteria_performance_tmp"], "model.google_ads.google_ads__click_performance": [], "model.google_ads.google_ads__url_ad_adapter": [], "model.google_ads.google_ads__criteria_ad_adapter": [], "model.google_ads_source.stg_google_ads__final_url_performance": ["model.google_ads.google_ads__url_ad_adapter", "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb", "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9"], "model.google_ads_source.stg_google_ads__criteria_performance": ["model.google_ads.google_ads__criteria_ad_adapter"], "model.google_ads_source.stg_google_ads__click_performance": ["model.google_ads.google_ads__click_performance", "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f"], "model.google_ads_source.stg_google_ads__criteria_performance_tmp": ["model.google_ads_source.stg_google_ads__criteria_performance", "model.google_ads_source.stg_google_ads__criteria_performance"], "model.google_ads_source.stg_google_ads__final_url_performance_tmp": ["model.google_ads_source.stg_google_ads__final_url_performance", "model.google_ads_source.stg_google_ads__final_url_performance"], "model.google_ads_source.stg_google_ads__click_performance_tmp": ["model.google_ads_source.stg_google_ads__click_performance", "model.google_ads_source.stg_google_ads__click_performance"], "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": [], "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": [], "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": [], "source.google_ads_source.adwords.ad_stats": [], "source.google_ads_source.adwords.ad_history": [], "source.google_ads_source.adwords.ad_group_history": [], "source.google_ads_source.adwords.campaign_history": [], "source.google_ads_source.adwords.account_history": [], "source.google_ads_source.adwords.final_url_performance": [], "source.google_ads_source.adwords.click_performance": [], "source.google_ads_source.adwords.criteria_performance": []}} \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/ci/sample.profiles.yml b/dbt_packages/google_ads/integration_tests/ci/sample.profiles.yml new file mode 100644 index 0000000..87166e4 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/ci/sample.profiles.yml @@ -0,0 +1,60 @@ + +# HEY! This file is used in the Google Ads integrations tests with CircleCI. +# You should __NEVER__ check credentials into version control. Thanks for reading :) + +config: + send_anonymous_usage_stats: False + use_colors: True + +integration_tests: + target: snowflake + outputs: + redshift: + type: redshift + host: "{{ env_var('CI_REDSHIFT_DBT_HOST') }}" + user: "{{ env_var('CI_REDSHIFT_DBT_USER') }}" + pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}" + dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}" + port: 5439 + schema: google_ads_integration_tests + threads: 8 + bigquery: + type: bigquery + method: service-account + keyfile: "{{ env_var('GCLOUD_SERVICE_KEY_PATH') }}" + project: 'dbt-package-testing' + schema: google_ads_integration_tests + threads: 8 + snowflake: + type: snowflake + account: "{{ env_var('CI_SNOWFLAKE_DBT_ACCOUNT') }}" + user: "{{ env_var('CI_SNOWFLAKE_DBT_USER') }}" + password: "{{ env_var('CI_SNOWFLAKE_DBT_PASS') }}" + role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}" + database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}" + warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}" + schema: google_ads_integration_tests + threads: 8 + spark: + type: spark + method: http + schema: google_ad_integration_test + host: "{{ env_var('CI_SPARK_DBT_HOST') }}" + organization: "{{ env_var('CI_SPARK_DBT_ORGANIZATION') }}" + token: "{{ env_var('CI_SPARK_DBT_TOKEN') }}" + cluster: "{{ env_var('CI_SPARK_DBT_CLUSTER') }}" + port: 443 + connect_timeout: 60 + connect_retries: 5 + threads: 4 + postgres: + type: postgres + host: "{{ env_var('CI_POSTGRES_DBT_HOST') }}" + user: "{{ env_var('CI_POSTGRES_DBT_USER') }}" + password: "{{ env_var('CI_POSTGRES_DBT_PASS') }}" + port: 5432 + dbname: "{{ env_var('CI_POSTGRES_DBT_DATABASE') }}" + schema: google_ads_integration_tests + threads: 8 + keepalives_idle: 0 + sslmode: prefer diff --git a/dbt_packages/google_ads/integration_tests/dbt_project.yml b/dbt_packages/google_ads/integration_tests/dbt_project.yml new file mode 100644 index 0000000..361fe6a --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/dbt_project.yml @@ -0,0 +1,58 @@ +name: 'google_ads_integration_tests' +version: '0.7.0' +profile: 'integration_tests' +config-version: 2 + +vars: + google_ads__final_url_performance: "{{ ref('google_ads_final_url_performance_data') }}" + google_ads__click_performance: "{{ ref('google_ads_click_performance_data') }}" + google_ads__criteria_performance: "{{ ref('google_ads_criteria_performance_data') }}" + google_ads__ad_stats: "{{ ref('google_ads_ad_stats_data') }}" + google_ads__ad_history: "{{ ref('google_ads_ad_history_data') }}" + google_ads__ad_group_history: "{{ ref('google_ads_ad_group_history_data') }}" + google_ads__campaign_history: "{{ ref('google_ads_campaign_history_data') }}" + google_ads__account_history: "{{ ref('google_ads_account_history_data') }}" + +seeds: + google_ads_integration_tests: + google_ads_click_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + criteria_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_criteria_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_final_url_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_stats_data: + +column_types: + customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + ad_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_campaign_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_group_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] diff --git a/dbt_packages/google_ads/integration_tests/packages.yml b/dbt_packages/google_ads/integration_tests/packages.yml new file mode 100644 index 0000000..b16d307 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/packages.yml @@ -0,0 +1,2 @@ +packages: + - local: ../ \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/requirements.txt b/dbt_packages/google_ads/integration_tests/requirements.txt new file mode 100644 index 0000000..5c612de --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/requirements.txt @@ -0,0 +1,6 @@ +dbt-snowflake~=1.0.0 +dbt-bigquery~=1.0.0 +dbt-redshift~=1.0.0 +dbt-postgres~=1.0.0 +dbt-spark~=1.0.0 +dbt-spark[PyHive]~=1.0.0 \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_account_history_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_account_history_data.csv new file mode 100644 index 0000000..e299c9b --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_account_history_data.csv @@ -0,0 +1,2 @@ +id,updated_at,_fivetran_synced,auto_tagging_enabled,currency_code,descriptive_name,final_url_suffix,hidden,manager,manager_customer_id,optimization_score,pay_per_conversion_eligibility_failure_reasons,test_account,time_zone,tracking_url_template +2121450128,2022-02-01 2:20:51,2022-02-01 2:20:52,TRUE,USD,,FALSE,FALSE,,0.5,[],FALSE,America/Los_Angeles,, \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_group_history_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_group_history_data.csv new file mode 100644 index 0000000..66b1806 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_group_history_data.csv @@ -0,0 +1,101 @@ +id,updated_at,_fivetran_synced,ad_group_rotation_mode,ad_group_type,base_ad_group_id,base_campaign_id,bidding_strategy_bid_ceiling,bidding_strategy_bid_changes_for_raises_only,bidding_strategy_bid_floor,bidding_strategy_bid_modifier,bidding_strategy_competitor_domain,bidding_strategy_cpa_bid_amount,bidding_strategy_cpc_bid_amount,bidding_strategy_cpm_bid_amount,bidding_strategy_enhanced_cpc_enabled,bidding_strategy_id,bidding_strategy_max_cpc_bid_ceiling,bidding_strategy_max_cpc_bid_floor,bidding_strategy_name,bidding_strategy_raise_bid_when_budget_constrained,bidding_strategy_raise_bid_when_low_quality_score,bidding_strategy_scheme_type,bidding_strategy_source,bidding_strategy_spend_target,bidding_strategy_strategy_goal,bidding_strategy_target_cpa,bidding_strategy_target_outrank_share,bidding_strategy_target_roas,bidding_strategy_target_roas_override,bidding_strategy_type,bidding_strategy_viewable_cpm_enabled,campaign_id,content_bid_criterion_type_group,final_url_suffix,status,tracking_url_template,campaign_name,name +19495104253,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104253,286221013,,,,,,,7160000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221013,UNSPECIFIED,,ENABLED,,oVFgipETrMywnJ6/ewsrag==,oVFgipETrMywnJ6/ewsrag== +19495104973,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104973,286221373,,,,,,,30000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221373,UNSPECIFIED,,ENABLED,,ZpgkqBWjbLa9WhhuMSNi0A==,ZpgkqBWjbLa9WhhuMSNi0A== +19495104613,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104613,286221133,,,,,,,9160000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221133,UNSPECIFIED,,ENABLED,,HYsgTGpx5xAPChknrmbp8A==,HYsgTGpx5xAPChknrmbp8A== +19494891733,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19494891733,286213813,,,,,,,5880000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286213813,UNSPECIFIED,,ENABLED,,Sm27L/ZQ+Cr4AfccPv1yww==,Sm27L/ZQ+Cr4AfccPv1yww== +123130088562,2021-08-23T12:58:42,2021-08-26T02:22:52.410,UNSPECIFIED,SEARCH_STANDARD,123130088562,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,dS2l8GFXdXV2fMnw/4M8cA== +123130088522,2021-08-23T12:58:42,2021-08-26T02:22:52.410,ROTATE_FOREVER,SEARCH_STANDARD,123130088522,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,p/jOB+IWVWqZnVKrfwZZSA== +123130088762,2021-08-23T12:58:42,2021-08-26T02:22:52.410,UNSPECIFIED,SEARCH_STANDARD,123130088762,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,ACYseD+ArWvEkQLMRU866Q== +121614771753,2021-09-02T16:50:15,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771753,2021-09-15T18:19:23,2021-09-16T02:21:55.297,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771753,2021-09-14T17:02:32,2021-09-15T02:23:03.112,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771793,2021-09-02T16:50:14,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,121614771793,12649004531,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004531,UNSPECIFIED,,ENABLED,,5+E5FkXEIUbqRD8dsxqMnA==,GRLUBqIoAZoFVot+4MyrEw== +119807941826,2021-09-02T16:50:15,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,119807941826,12661488925,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12661488925,UNSPECIFIED,,ENABLED,,bamZHp8M//g/wZkn+vEcMg==,aOgzIZFTjWFu6C7ts/H6Cw== +127258434700,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,ENABLED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434700,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,PAUSED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434700,2021-08-27T14:26:05,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,ENABLED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,PAUSED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,ENABLED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-08-27T14:28:04,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,ENABLED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-08-27T14:29:24,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,ENABLED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,PAUSED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,ENABLED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +78990169090,2021-08-25T20:21:09.602,2021-08-25T20:21:15.317,UNSPECIFIED,DISPLAY_STANDARD,78990169090,8106652778,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,8106652778,UNSPECIFIED,,ENABLED,,XHBL7S0hRe9ED3Wlg+P7rg==,Xglfg5UzHVr7LcqmHRG0dA== +57498468408,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57498468408,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,wG1LLw2nfQm4J7jB7nzB1g== +52792597675,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,52792597675,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,p/jOB+IWVWqZnVKrfwZZSA== +53082413518,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,53082413518,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,AllP3uWEv05eGD1PbAvi9g== +57782427513,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,OPTIMIZE,DISPLAY_STANDARD,57782427513,1438324780,,,,,,,250000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1438324780,UNSPECIFIED,,ENABLED,,7rKssxier5+GtrCeJEoo+A==,XnXu96kJozWIB1kDLur1CA== +54087239006,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,54087239006,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,bWDYY4R5YY4hFNN6e+cmyg== +55991028475,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,55991028475,1399909916,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,bYq4SJQTdWsa9r2ra4CGPg== +52024440901,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,52024440901,1399909916,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,dPXQ0CAUvqTBp9uObhYTaA== +57782826160,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57782826160,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,OchM9hPHDjfBHG/+BuTFmw== +58896448727,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,58896448727,1399909916,,,,,,,12500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,l3iECgEAyzDJgodnQbC1og== +59007928281,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,59007928281,1399909916,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,XsE/1vcgp/7AMxwOzBTBhg== +57782745520,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57782745520,1399909916,,,,,,,28000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,nSzvDWGwKEjFKKBw7XXFcA== +60675653012,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,60675653012,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,5JRNrRc5OrHRTM8hMs8ADw== +53669478365,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,53669478365,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,9Oirip+WywzCuzpbTXorcA== +67495605528,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,67495605528,853120072,,,,,,,17500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,pWIcPXoMTd8p8ZiBX6pNCw== +23289502333,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23289502333,343273573,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,yOBKziaSfeNDXyh/0Bxp1Q== +23437386733,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23437386733,343273573,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,8bzbc8hoTrH52JpcPhMYcQ== +23262149533,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149533,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,OHuvAZnnycyUT66U6WRI+g== +23262149293,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149293,343273573,,,,,,,25000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,oRK/7iCw1jSQ6T58aHM43w== +23262149413,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149413,343273573,,,,,,,25000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,cC/fQ+l4O/008dYXm3rjPA== +23262149173,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149173,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,yMIloAIamphW3cLfNKDnRw== +23661054253,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,OPTIMIZE,DISPLAY_STANDARD,23661054253,347984173,,,,,,,450000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,347984173,UNSPECIFIED,,PAUSED,,L9N+m+49Zy31Qyhh3hHbsw==,hw1PVsfBNzHjxK9eChd8eg== +50721178530,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,50721178530,1399909916,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,Vq5teB085Q6bBdSWRwkYWw== +44654453181,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,44654453181,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,OchM9hPHDjfBHG/+BuTFmw== +48635019530,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,48635019530,853120072,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,bYq4SJQTdWsa9r2ra4CGPg== +46529218685,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,46529218685,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,5JRNrRc5OrHRTM8hMs8ADw== +43937217536,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217536,853120072,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,dPXQ0CAUvqTBp9uObhYTaA== +43937217736,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217736,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,9Oirip+WywzCuzpbTXorcA== +43937217976,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217976,853120072,,,,,,,12500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,l3iECgEAyzDJgodnQbC1og== +43937218536,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937218536,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,bWDYY4R5YY4hFNN6e+cmyg== +43937217056,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217056,853120072,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,XsE/1vcgp/7AMxwOzBTBhg== +43937217496,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217496,853120072,,,,,,,28000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,nSzvDWGwKEjFKKBw7XXFcA== +51817201437,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,51817201437,853120072,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,Vq5teB085Q6bBdSWRwkYWw== +51160711183,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,OPTIMIZE,DISPLAY_STANDARD,51160711183,1068458078,,,,,,,7000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1068458078,UNSPECIFIED,,ENABLED,,aTIg0XwVsLY4T1/IBssjMg==,uW+f8HsyjSNAPwNIQq4tVg== +123130088562,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,UNSPECIFIED,SEARCH_STANDARD,123130088562,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,dS2l8GFXdXV2fMnw/4M8cA== +123130088522,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,ROTATE_FOREVER,SEARCH_STANDARD,123130088522,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,p/jOB+IWVWqZnVKrfwZZSA== +123130088762,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,UNSPECIFIED,SEARCH_STANDARD,123130088762,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,ACYseD+ArWvEkQLMRU866Q== +115267581594,2021-08-25T20:21:09.602,2021-08-25T20:21:15.357,UNSPECIFIED,SEARCH_STANDARD,115267581594,10585797078,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,10585797078,UNSPECIFIED,,ENABLED,,u4quEw2JbeRImvRXD2Trzw==,p/jOB+IWVWqZnVKrfwZZSA== +112410973654,2021-08-25T20:21:09.602,2021-08-25T20:21:15.357,UNSPECIFIED,DISPLAY_STANDARD,112410973654,11679596622,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,11679596622,UNSPECIFIED,,ENABLED,,IGZK1Qv1Yy+OCkr/xF7pyA==,4Alew4qrf1hc5Dudzq3Dzg== +23262149053,2021-08-25T20:21:09.602,2021-08-25T20:21:15.314,UNSPECIFIED,SEARCH_STANDARD,23262149053,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,pDmuomxqSN6rWw5TUsrSQA== +123365957459,2021-08-25T20:21:09.602,2021-08-25T20:21:15.377,UNSPECIFIED,SEARCH_STANDARD,123365957459,13394597257,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13394597257,UNSPECIFIED,,ENABLED,,2q4X0Mq7Q1zY3OAP6qDwQg==,p/jOB+IWVWqZnVKrfwZZSA== +127701718208,2021-08-25T20:21:09.602,2021-08-25T20:21:15.387,OPTIMIZE,DISPLAY_STANDARD,127701718208,13047335654,,,,,,,4000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13047335654,UNSPECIFIED,,ENABLED,,WF1E+iJUjNQ1hBcCQSHkLg==,Dgdx4cvumsqzPS0LFplOjQ== +121614771753,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121314851702,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,OPTIMIZE,DISPLAY_STANDARD,121314851702,13624090262,,,,,,,4000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13624090262,UNSPECIFIED,,ENABLED,,LqLxEd5TpCz+7+Y4rsJ8rw==,MRURW8Op+P/m1PnWaLw4jw== +121614771793,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,UNSPECIFIED,DISPLAY_STANDARD,121614771793,12649004531,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004531,UNSPECIFIED,,ENABLED,,5+E5FkXEIUbqRD8dsxqMnA==,GRLUBqIoAZoFVot+4MyrEw== +119807941826,2021-08-25T20:21:09.602,2021-08-25T20:21:15.363,UNSPECIFIED,DISPLAY_STANDARD,119807941826,12661488925,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12661488925,UNSPECIFIED,,ENABLED,,bamZHp8M//g/wZkn+vEcMg==,aOgzIZFTjWFu6C7ts/H6Cw== +123862817162,2021-08-25T20:21:09.602,2021-08-25T20:21:15.384,OPTIMIZE,DISPLAY_STANDARD,123862817162,13073443628,,,,,,,3000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13073443628,UNSPECIFIED,,ENABLED,,OwgBvOxMOr/L4lKQFoFILQ==,Dgdx4cvumsqzPS0LFplOjQ== +102358069431,2021-08-25T20:21:09.602,2021-08-25T20:21:15.320,UNSPECIFIED,SEARCH_STANDARD,102358069431,9714806126,,,,,,,6200000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,9714806126,UNSPECIFIED,,REMOVED,,k0vhyISxowyWI/0nsdM52A==,bYq4SJQTdWsa9r2ra4CGPg== +102358069391,2021-08-25T20:21:09.602,2021-08-25T20:21:15.320,UNSPECIFIED,SEARCH_STANDARD,102358069391,9714806126,,,,,,,6200000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,9714806126,UNSPECIFIED,,REMOVED,,k0vhyISxowyWI/0nsdM52A==,e/jOBDm/oJw+eYig1/gswQ== +123365942779,2021-08-25T20:21:09.602,2021-08-25T20:21:15.373,UNSPECIFIED,SEARCH_STANDARD,123365942779,13394597224,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13394597224,UNSPECIFIED,,ENABLED,,QBtRes27/gex2z72qaMDgg==,p/jOB+IWVWqZnVKrfwZZSA== +83290854223,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,83290854223,8177394616,,,,,,,7500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,8177394616,UNSPECIFIED,,ENABLED,,qvMnu3BagNbM34MtxWzuiQ==,Xglfg5UzHVr7LcqmHRG0dA== +80249387743,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387743,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,zwSgLje3dPwxGkj2BcPFlw== +80249387703,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387703,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,CMjDoLXZJifyT+2Hiv2DJQ== +80249387503,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387503,7776638574,,,,,,,2340000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,PAUSED,,C35vU2KVzHAMi4J87zuq7Q==,+oTiAtSMShLUkBbvuRAAww== +80249387663,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387663,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,M7IEKlEgxTGqsNkhw9NobA== +82252391000,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252391000,6838862325,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862325,UNSPECIFIED,,ENABLED,,Rhb3xtXrLTXJx+sBTiv35w==,bYq4SJQTdWsa9r2ra4CGPg== +82252390960,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390960,6838862325,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862325,UNSPECIFIED,,ENABLED,,Rhb3xtXrLTXJx+sBTiv35w==,bWDYY4R5YY4hFNN6e+cmyg== +82252390720,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390720,6838862322,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862322,UNSPECIFIED,,ENABLED,,lYY67y/9rjNTtHRjrZM2DA==,bYq4SJQTdWsa9r2ra4CGPg== +82252390680,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390680,6838862322,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862322,UNSPECIFIED,,ENABLED,,lYY67y/9rjNTtHRjrZM2DA==,bWDYY4R5YY4hFNN6e+cmyg== +81250598054,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,DISPLAY_STANDARD,81250598054,7979319798,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7979319798,UNSPECIFIED,,ENABLED,,5CRdxH7BGHtvtrfvpMSWoQ==,0xBG8PJ7jVGuWjXXKa1joQ== +127791017758,2021-09-11T21:55:05,2021-09-12T08:21:56.009,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T00:59:15,2021-09-09T08:22:52.042,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-19T01:34:05,2021-09-19T11:18:11.689,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-11T16:00:56,2021-09-12T02:22:25.615,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-08T06:48:15,2021-09-08T14:24:06.752,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T10:36:03,2021-09-12T20:22:32.526,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T09:06:53,2021-09-09T20:23:06.838,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-13T00:36:39,2021-09-13T08:23:01.591,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T08:28:42,2021-09-10T20:22:38.643,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-11T03:48:43,2021-09-11T14:23:35.820,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-18T07:03:11,2021-09-18T20:23:23.158,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T14:54:27,2021-09-10T02:22:31.920,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T21:09:24,2021-09-10T08:23:54.237,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T16:10:54,2021-09-13T02:21:29.021,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T21:18:30,2021-09-11T08:22:24.852,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T04:14:52,2021-09-12T14:26:59.953,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T02:50:33,2021-09-09T14:23:42.449,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-08T18:25:49,2021-09-09T02:22:13.914,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T02:54:37,2021-09-10T14:24:02.909,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_history_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_history_data.csv new file mode 100644 index 0000000..2a30da7 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_history_data.csv @@ -0,0 +1,27 @@ +ad_group_id,id,updated_at,_fivetran_synced,action_items,ad_strength,added_by_google_ads,device_preference,display_url,final_app_urls,final_mobile_urls,final_url_suffix,final_urls,name,policy_summary_approval_status,policy_summary_review_status,status,system_managed_resource_source,tracking_url_template,type,url_collections +123365950779,525896765665,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365950779,525896765671,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365950779,525896765668,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365952859,525896766205,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365952859,525896766208,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832865,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832859,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832862,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416497,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416491,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416494,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960339,525845434008,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495961,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495964,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495958,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970219,525845495994,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970219,525845495997,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496129,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496132,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496126,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191777,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191783,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191780,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290582,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290585,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290588,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_stats_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_stats_data.csv new file mode 100644 index 0000000..50c8dd6 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_ad_stats_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,customer_id,date,_fivetran_synced,active_view_impressions,active_view_measurability,active_view_measurable_cost_micros,active_view_measurable_impressions,active_view_viewability,ad_group,ad_group_base_ad_group,ad_id,ad_network_type,campaign_base_campaign,campaign_id,clicks,conversions,conversions_value,cost_micros,device,impressions,interaction_event_types,interactions,keyword_ad_group_criterion,view_through_conversions ++oVKJN86MT4jtbpWTdzq5FKzxIk=,2121450128,2021-05-31,2021-06-30T14:21:51.597,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869462,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,400000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +ap+fpQLWMwzpCZRQ1vx1mqZVRko=,2121450128,2021-05-31,2021-06-30T14:21:51.595,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,3,0,0,20350000,DESKTOP,44,[CLICK],3,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +c6wkqjjdx//JMG6ZN1g6DZEgNzU=,2121450128,2021-05-31,2021-06-30T14:21:51.597,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,2,0,0,1760000,MOBILE,25,[CLICK],2,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +RNvb6cEe55GnJx1NMcg7wAKPtrs=,2121450128,2021-05-31,2021-06-30T14:21:55.492,0,0,0,0,0,customers/2121450128/adGroups/100031227814,customers/2121450128/adGroups/100031227814,447123671939,SEARCH,customers/2121450128/campaigns/10059986072,10059986072,1,0,0,6870000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100031227814~71669451,0 +Inlx+IoFCvH1HCQNkMlVXbEkv08=,2121450128,2021-05-31,2021-06-30T14:21:57.449,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,440798626012,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,2,0,0,5750000,DESKTOP,20,[CLICK],2,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +F4eU72uHBZaPLMK721Jc7b8oFyk=,2121450128,2021-05-31,2021-06-30T14:21:57.449,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,440798626015,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,5,0,0,33090000,DESKTOP,216,[CLICK],5,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +vAtsKWH+yKd0vJ9URe+JQTTrLbo=,2121450128,2021-05-31,2021-06-30T14:21:57.450,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,521172639994,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,1,0,0,10020000,DESKTOP,51,[CLICK],1,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +d9psAM0NjCypw/glRQzggLzLU1o=,2121450128,2021-05-31,2021-06-30T14:21:57.451,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,521172639994,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,1,0,0,2580000,MOBILE,39,[CLICK],1,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +DWNXMorQm+s7LuTvCoSeWSPnrOM=,2121450128,2021-05-31,2021-06-30T14:21:58.227,0,0,0,0,0,customers/2121450128/adGroups/101951711666,customers/2121450128/adGroups/101951711666,440798626018,SEARCH,customers/2121450128/campaigns/10265563824,10265563824,1,0,0,510000,MOBILE,6,[CLICK],1,customers/2121450128/adGroupCriteria/101951711666~71669451,0 +1uA5l1aF2cpv9ro8ysKeYLCXngg=,2121450128,2021-05-31,2021-06-30T14:21:59.983,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372728,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,10220000,DESKTOP,61,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~71669451,0 +HMjeNQTWf6EmsGpncJKxf5QJ8xA=,2121450128,2021-05-31,2021-06-30T14:21:59.983,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,12720000,DESKTOP,59,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~71669451,0 +EI7r7yN8LvwrTaySho1BFiFXvu4=,2121450128,2021-05-31,2021-06-30T14:22:05.397,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,4,0,0,16720000,DESKTOP,71,[CLICK],4,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +18BxrfBf0yIX2sRHRlDU/grXCBE=,2121450128,2021-05-31,2021-06-30T14:22:05.398,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372749,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,2250000,MOBILE,9,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +d6exSZISKKaj30rkrOmO3ORJPQA=,2121450128,2021-05-31,2021-06-30T14:22:05.398,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,3540000,MOBILE,12,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +0BYmZBpYQF6Bc2YcIuDIET89k5k=,2121450128,2021-05-31,2021-06-30T14:22:08.464,0,0,0,0,0,customers/2121450128/adGroups/116360595776,customers/2121450128/adGroups/116360595776,501663698086,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,4360000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/116360595776~71669451,0 +7PkcN+xyoYlKlp8Ek4Z//ds6XqM=,2121450128,2021-05-31,2021-06-30T14:22:08.657,0,0,0,0,0,customers/2121450128/adGroups/116360595976,customers/2121450128/adGroups/116360595976,489811287055,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7360000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/116360595976~71669451,0 +c2do31haXvOuFxgtDh81uHMORQQ=,2121450128,2021-05-31,2021-06-30T14:22:08.731,0,0,0,0,0,customers/2121450128/adGroups/117251040378,customers/2121450128/adGroups/117251040378,489811287487,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6250000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/117251040378~90123981,0 +oke0L3bSIX0klpQj8Cpn3GUYGDE=,2121450128,2021-05-31,2021-06-30T14:22:08.857,0,0,0,0,0,customers/2121450128/adGroups/117251040618,customers/2121450128/adGroups/117251040618,489811287289,SEARCH,customers/2121450128/campaigns/12000408920,12000408920,1,0,0,6310000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/117251040618~71669451,0 +qg2HBTFlPHil7xUUmIh+waqSsK8=,2121450128,2021-05-31,2021-06-30T14:22:09.572,0,0,0,0,0,customers/2121450128/adGroups/117280839484,customers/2121450128/adGroups/117280839484,488103213532,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,7510000,DESKTOP,50,[CLICK],1,customers/2121450128/adGroupCriteria/117280839484~89698374,0 +8jkuI/3pcO9QREU/lLzVCtXHTvI=,2121450128,2021-05-31,2021-06-30T14:22:10.111,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069827,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,7270000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/117819878825~71669451,0 +rqHHldhKwGCQBjp7ATp8o6/bPRA=,2121450128,2021-05-31,2021-06-30T14:22:11.108,0,0,0,0,0,customers/2121450128/adGroups/117819890145,customers/2121450128/adGroups/117819890145,501679544638,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,1,0,0,1380000,DESKTOP,20,[CLICK],1,customers/2121450128/adGroupCriteria/117819890145~71669451,0 +qkr+vdUQazL+dxepNLTVa43YNqI=,2121450128,2021-05-31,2021-06-30T14:22:11.267,0,0,0,0,0,customers/2121450128/adGroups/119841296085,customers/2121450128/adGroups/119841296085,517530516158,SEARCH,customers/2121450128/campaigns/12867542628,12867542628,1,0,0,6350000,DESKTOP,24,[CLICK],1,customers/2121450128/adGroupCriteria/119841296085~25487590,0 +RxnFia9JnBFINv2XEh2vtjzqbEk=,2121450128,2021-05-31,2021-06-30T14:22:09.406,0,0,0,0,0,customers/2121450128/adGroups/117280839284,customers/2121450128/adGroups/117280839284,488103213508,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,18600000,DESKTOP,14,[CLICK],1,customers/2121450128/adGroupCriteria/117280839284~501465725,0 +lz+5CY9dlIRbXprAls+BO45K3dA=,2121450128,2021-05-31,2021-06-30T14:22:09.642,0,0,0,0,0,customers/2121450128/adGroups/117280839484,customers/2121450128/adGroups/117280839484,491817470070,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,4740000,MOBILE,15,[CLICK],1,customers/2121450128/adGroupCriteria/117280839484~161179893,0 +656hn/z3/Yfv8yKD3cEr0hOLFWc=,2121450128,2021-05-31,2021-06-30T14:22:11.818,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814482,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6110000,DESKTOP,17,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~501465725,0 +BUvy1RLcC4Mk1px9ftxBIEySiKs=,2121450128,2021-05-31,2021-06-30T14:22:11.818,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6280000,DESKTOP,10,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~501465725,0 +eYaVw07jXFkIo3Vo6l4mEyJUlX0=,2121450128,2021-05-31,2021-06-30T14:22:08.751,0,0,0,0,0,customers/2121450128/adGroups/117251040378,customers/2121450128/adGroups/117251040378,489811287487,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6040000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/117251040378~1522787749,0 +105XI6w8DXEenKQ+SqbOrQQQO4k=,2121450128,2021-05-31,2021-06-30T14:22:09.454,0,0,0,0,0,customers/2121450128/adGroups/117280839284,customers/2121450128/adGroups/117280839284,491817470064,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,13590000,MOBILE,2,[CLICK],1,customers/2121450128/adGroupCriteria/117280839284~1522787749,0 +pJ5VAAl83A75jr7hR+XU6k1E310=,2121450128,2021-05-31,2021-06-30T14:21:47.722,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,501663698053,SEARCH,customers/2121450128/campaigns/344106493,344106493,1,0,0,4160000,DESKTOP,11,[CLICK],1,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +FjtEeA0LBJ5b7c3SUGc4y/bFCu0=,2121450128,2021-05-31,2021-06-30T14:21:47.703,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658632,SEARCH,customers/2121450128/campaigns/344106493,344106493,2,0,0,11600000,DESKTOP,10,[CLICK],2,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +Hjk2/EBAi2Oy3kJuFYte9qHT53k=,2121450128,2021-05-31,2021-06-30T14:21:47.720,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658635,SEARCH,customers/2121450128/campaigns/344106493,344106493,2,0,0,9620000,DESKTOP,16,[CLICK],2,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +zuxIvK3b0e7navO6hLYMmi90zIY=,2121450128,2021-05-31,2021-06-30T14:21:47.661,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658629,SEARCH,customers/2121450128/campaigns/344106493,344106493,3,0,0,8970000,DESKTOP,17,[CLICK],3,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +bFjuQLq4Y9bzd6jCCoLr44+POsE=,2121450128,2021-05-31,2021-06-30T14:21:51.322,0,0,0,0,0,customers/2121450128/adGroups/99966172536,customers/2121450128/adGroups/99966172536,489811287037,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,4680000,MOBILE,2,[CLICK],1,customers/2121450128/adGroupCriteria/99966172536~39447438670,0 +ywN4XbKlPdZ4Y7SVwbIm1Omt+A4=,2121450128,2021-05-31,2021-06-30T14:21:52.443,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869465,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,350000,MOBILE,20,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24010400560,0 +wgLN27cvOriL3o0UL/anK/taKrw=,2121450128,2021-05-31,2021-06-30T14:21:52.441,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869465,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,1560000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24010400560,0 +U8E94M7NzgDUzOlquZAywv7ZwYc=,2121450128,2021-05-31,2021-06-30T14:21:52.700,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,8700000,DESKTOP,46,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24314127775,0 +g3Qk03aAjAjpHSaDx5/pXbRAoOc=,2121450128,2021-05-31,2021-06-30T14:21:52.705,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,730000,MOBILE,21,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24314127775,0 +xb0wersc/oE/Qtvp3O5I5Tetqfo=,2121450128,2021-05-31,2021-06-30T14:21:52.923,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,5700000,DESKTOP,14,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~39447438670,0 +4qBfyK0ELOIJcIZuSN8Q7NEBaYA=,2121450128,2021-05-31,2021-06-30T14:21:54.306,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,10000000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418504627,0 +8qn5c4H0FZ/OQegiUXAaKZ7SW2Q=,2121450128,2021-05-31,2021-06-30T14:21:54.305,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869468,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,2950000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418504627,0 +skGNPEPQ17ScvvYa8JGfaVBbk0I=,2121450128,2021-05-31,2021-06-30T14:21:54.475,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869468,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,1250000,DESKTOP,19,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418511347,0 +2mCEo6O1t0vIVtgooC/7dznSP48=,2121450128,2021-05-31,2021-06-30T14:21:54.776,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,2,0,0,4350000,DESKTOP,28,[CLICK],2,customers/2121450128/adGroupCriteria/100031227614~24055148960,0 +7ffyuBPp05kVyl9J/I/osI8OAdE=,2121450128,2021-05-31,2021-06-30T14:21:54.778,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,3,0,0,2920000,MOBILE,26,[CLICK],3,customers/2121450128/adGroupCriteria/100031227614~24055148960,0 +zSplpYiICMhSICVSoVW1W8IDrkg=,2121450128,2021-05-31,2021-06-30T14:21:55.147,0,0,0,0,0,customers/2121450128/adGroups/100031227654,customers/2121450128/adGroups/100031227654,514818869474,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,2190000,DESKTOP,22,[CLICK],1,customers/2121450128/adGroupCriteria/100031227654~19689304787,0 +FL93LU78YH7W7q1hFLEPk8+WEzw=,2121450128,2021-05-31,2021-06-30T14:21:55.599,0,0,0,0,0,customers/2121450128/adGroups/100031227814,customers/2121450128/adGroups/100031227814,447123671936,SEARCH,customers/2121450128/campaigns/10059986072,10059986072,1,0,0,4590000,MOBILE,4,[CLICK],1,customers/2121450128/adGroupCriteria/100031227814~24314127775,0 +VfME9/Mr5P3WXKeeA97BZn9ffAE=,2121450128,2021-05-31,2021-06-30T14:21:56.503,0,0,0,0,0,customers/2121450128/adGroups/100036258295,customers/2121450128/adGroups/100036258295,428943607631,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,5810000,MOBILE,13,[CLICK],1,customers/2121450128/adGroupCriteria/100036258295~39447438670,0 +xNtt6hXkPk/sacDpsp7qWwvZ3jw=,2121450128,2021-05-31,2021-06-30T14:21:56.502,0,0,0,0,0,customers/2121450128/adGroups/100036258295,customers/2121450128/adGroups/100036258295,491819326258,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,9800000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/100036258295~39447438670,0 +LSdVe4Y6fsNAQkuag64zFWGM/bk=,2121450128,2021-05-31,2021-06-30T14:21:56.756,0,0,0,0,0,customers/2121450128/adGroups/100036258455,customers/2121450128/adGroups/100036258455,491806298580,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,13730000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100036258455~19418511347,0 +yjU8RkTbviDB4god0VvfrLLz78I=,2121450128,2021-05-31,2021-06-30T14:21:57.065,0,0,0,0,0,customers/2121450128/adGroups/100036258455,customers/2121450128/adGroups/100036258455,491806298580,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,23580000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/100036258455~29554867064,0 +PA9rSKFC5GVFTs2YoGPgZGiFVnk=,2121450128,2021-05-31,2021-06-30T14:21:59.514,0,0,0,0,0,customers/2121450128/adGroups/102174442962,customers/2121450128/adGroups/102174442962,432430823447,SEARCH,customers/2121450128/campaigns/9928118134,9928118134,1,0,0,75530000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/102174442962~19418511347,0 +fHfi9GHmNCjaKOtctOPx/F59NK0=,2121450128,2021-05-31,2021-06-30T14:21:59.665,0,0,0,0,0,customers/2121450128/adGroups/102174443002,customers/2121450128/adGroups/102174443002,432430823453,SEARCH,customers/2121450128/campaigns/9928118134,9928118134,1,0,0,74960000,DESKTOP,38,[CLICK],1,customers/2121450128/adGroupCriteria/102174443002~19689304787,0 +Nm6txp7eOi8DxrzJaZYScCgIGJM=,2121450128,2021-05-31,2021-06-30T14:22:00.180,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,11000000,DESKTOP,40,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~24314127775,0 +CodlUlWgL9YKKiBUh0ONBaOd9IQ=,2121450128,2021-05-31,2021-06-30T14:22:00.231,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,6340000,DESKTOP,6,[CLICK],1,customers/2121450128/adGroupCriteria/104933764975~39447438670,0 +iLwtcym6lFMRmaSEfzPjOuTMIFk=,2121450128,2021-05-31,2021-06-30T14:22:00.230,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372728,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,2890000,DESKTOP,34,[CLICK],1,customers/2121450128/adGroupCriteria/104933764975~39447438670,0 +4IU5XSBhCB19ogiZdH3uvv9i+rM=,2121450128,2021-05-31,2021-06-30T14:22:00.736,0,0,0,0,0,customers/2121450128/adGroups/104933765015,customers/2121450128/adGroups/104933765015,479686372734,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,5970000,DESKTOP,48,[CLICK],1,customers/2121450128/adGroupCriteria/104933765015~19418511347,0 +Gc57fzxkdG98ewspASzoglK1yR8=,2121450128,2021-05-31,2021-06-30T14:22:00.796,0,0,0,0,0,customers/2121450128/adGroups/104933765015,customers/2121450128/adGroups/104933765015,479686372737,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,3390000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/104933765015~20820075849,0 +2fF0zmHuUgScx3pv8HmTwx3j/DM=,2121450128,2021-05-31,2021-06-30T14:22:00.966,0,0,0,0,0,customers/2121450128/adGroups/104933765175,customers/2121450128/adGroups/104933765175,479686372740,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,5150000,DESKTOP,88,[CLICK],1,customers/2121450128/adGroupCriteria/104933765175~19689304787,0 +rAKUJOWLBBRBugN2uctqYe4QYO0=,2121450128,2021-05-31,2021-06-30T14:22:04.172,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8840000,DESKTOP,19,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~24010400560,0 ++FYF1rP83I6SAsGO4sqbUq7JfZE=,2121450128,2021-05-31,2021-06-30T14:22:04.209,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,2,0,0,18960000,DESKTOP,72,[CLICK],2,customers/2121450128/adGroupCriteria/105484728914~24314127775,0 +0x5KhXJdfYyVa1yQExBqsLXmBmU=,2121450128,2021-05-31,2021-06-30T14:22:04.210,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,5240000,MOBILE,20,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~24314127775,0 +Kri0injwkAQiTrxf9ifvTE6P3pw=,2121450128,2021-05-31,2021-06-30T14:22:04.265,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,7110000,DESKTOP,31,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~39447438670,0 +FsE0Ssf6rdIu/b5Kagm9Jbv+ja8=,2121450128,2021-05-31,2021-06-30T14:22:04.582,0,0,0,0,0,customers/2121450128/adGroups/105484728954,customers/2121450128/adGroups/105484728954,479686372698,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8930000,DESKTOP,24,[CLICK],1,customers/2121450128/adGroupCriteria/105484728954~19418511347,0 +85GH3UxqzDOim/yJp4ErS08TFLE=,2121450128,2021-05-31,2021-06-30T14:22:04.977,0,0,0,0,0,customers/2121450128/adGroups/105484729114,customers/2121450128/adGroups/105484729114,479686372707,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8240000,MOBILE,10,[CLICK],1,customers/2121450128/adGroupCriteria/105484729114~19689304787,0 +BfaV8UEEqfg+KezVKDmPhj6lDFs=,2121450128,2021-05-31,2021-06-30T14:22:04.976,0,0,0,0,0,customers/2121450128/adGroups/105484729114,customers/2121450128/adGroups/105484729114,479686372704,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8350000,DESKTOP,61,[CLICK],1,customers/2121450128/adGroupCriteria/105484729114~19689304787,0 +wt37ofNgeVcfic1HvCQKLl5HgGk=,2121450128,2021-05-31,2021-06-30T14:22:05.545,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,2,0,0,6470000,DESKTOP,38,[CLICK],2,customers/2121450128/adGroupCriteria/106366276743~39447438670,0 +z/KP1bFoC2EBieisqN/vCMsyXdI=,2121450128,2021-05-31,2021-06-30T14:22:05.546,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,2280000,TABLET,1,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~39447438670,0 +Ltrw5I+MGMXEzvTb4ixSUkfCEvo=,2121450128,2021-05-31,2021-06-30T14:22:05.774,0,0,0,0,0,customers/2121450128/adGroups/106366276943,customers/2121450128/adGroups/106366276943,479686372752,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,5800000,MOBILE,46,[CLICK],1,customers/2121450128/adGroupCriteria/106366276943~19689304787,0 +2+gOKTYfAEu+Fr/4hvgv6O9/sEw=,2121450128,2021-05-31,2021-06-30T14:22:08.307,0,0,0,0,0,customers/2121450128/adGroups/114921466265,customers/2121450128/adGroups/114921466265,489811287109,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,6430000,DESKTOP,8,[CLICK],1,customers/2121450128/adGroupCriteria/114921466265~39447438670,0 +PwmN3XOod0yuW3gdkSueGlh2h+M=,2121450128,2021-05-31,2021-06-30T14:22:08.309,0,0,0,0,0,customers/2121450128/adGroups/114921466265,customers/2121450128/adGroups/114921466265,501663698065,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,3690000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/114921466265~39447438670,0 +HXdP5nae906jJeQ8nKXo9cDjPEg=,2121450128,2021-05-31,2021-06-30T14:22:08.380,0,0,0,0,0,customers/2121450128/adGroups/115267581594,customers/2121450128/adGroups/115267581594,514470814272,SEARCH,customers/2121450128/campaigns/10585797078,10585797078,2,0,0,6660000,MOBILE,6,[CLICK],2,customers/2121450128/adGroupCriteria/115267581594~20080213458,0 +7tgWYoxmF5xy3qGG10PlOYlHuPU=,2121450128,2021-05-31,2021-06-30T14:22:08.826,0,0,0,0,0,customers/2121450128/adGroups/117251040418,customers/2121450128/adGroups/117251040418,489811287499,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6320000,DESKTOP,23,[CLICK],1,customers/2121450128/adGroupCriteria/117251040418~19689304787,0 +7QJraBE/0BxJf6t6bemmJ7KH6wE=,2121450128,2021-05-31,2021-06-30T14:22:10.256,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069962,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,8490000,DESKTOP,11,[CLICK],2,customers/2121450128/adGroupCriteria/117819878825~24314127775,0 +4hNQX8IXH8jfYFj9qrTxOAZZCa0=,2121450128,2021-05-31,2021-06-30T14:22:10.308,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069827,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,4850000,DESKTOP,37,[CLICK],2,customers/2121450128/adGroupCriteria/117819878825~39447438670,0 +OsBMfZJakpK+CleYkLdm/M3PS6c=,2121450128,2021-05-31,2021-06-30T14:22:10.614,0,0,0,0,0,customers/2121450128/adGroups/117819878865,customers/2121450128/adGroups/117819878865,501720069986,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,3800000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/117819878865~29554867064,0 +Y12Hl71oH/FKLUwjUC1bWojskTY=,2121450128,2021-05-31,2021-06-30T14:22:10.614,0,0,0,0,0,customers/2121450128/adGroups/117819878865,customers/2121450128/adGroups/117819878865,501720069980,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,9870000,DESKTOP,31,[CLICK],2,customers/2121450128/adGroupCriteria/117819878865~29554867064,0 +bPKzrcwPaN/VpAuB17n7M+sOH3k=,2121450128,2021-05-31,2021-06-30T14:22:10.654,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720070013,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,11420000,DESKTOP,85,[CLICK],1,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +KHEWQUEG62xm6x9VYujNUYoYicQ=,2121450128,2021-05-31,2021-06-30T14:22:10.653,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720069998,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,4600000,DESKTOP,99,[CLICK],2,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +DZn1rXI5fSEZBcmiaWT9IB9l39o=,2121450128,2021-05-31,2021-06-30T14:22:10.664,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720069998,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,5660000,MOBILE,10,[CLICK],1,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +P5XYeo3L56JHlnQRIpj1WASSBPI=,2121450128,2021-05-31,2021-06-30T14:22:11.055,0,0,0,0,0,customers/2121450128/adGroups/117819889425,customers/2121450128/adGroups/117819889425,501719794547,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,1,0,0,2200000,DESKTOP,3,[CLICK],1,customers/2121450128/adGroupCriteria/117819889425~24314127775,0 +xHkBLqBScvSOxE01fZtBi3pqsFM=,2121450128,2021-05-31,2021-06-30T14:22:11.055,0,0,0,0,0,customers/2121450128/adGroups/117819889425,customers/2121450128/adGroups/117819889425,501719794523,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,2,0,0,5390000,DESKTOP,4,[CLICK],2,customers/2121450128/adGroupCriteria/117819889425~24314127775,0 +o2XKa9yvKPGlVvdmjzlJoZUeniQ=,2121450128,2021-05-31,2021-06-30T14:22:11.882,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814482,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,7260000,DESKTOP,29,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~19418511347,0 +Z1EzY3+p1FPLzEMLrFzE3Sb1kiw=,2121450128,2021-05-31,2021-06-30T14:22:11.960,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,2,0,0,11040000,DESKTOP,58,[CLICK],2,customers/2121450128/adGroupCriteria/122377267104~24055148960,0 +2mNqGnW2Fgzo6TYDyvG03xqZbmg=,2121450128,2021-05-31,2021-06-30T14:22:11.977,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4170000,MOBILE,27,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~29554867064,0 +udmr23DjE9hdNmN84/QrASgdJBw=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814503,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,4,0,0,18030000,MOBILE,49,[CLICK],4,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +BkDUpZeilwnyPN53IENCMs0Lc+M=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814509,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4450000,MOBILE,3,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +ftYXFB4nHbkIzMiy3vFMkVtxecg=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814515,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,7990000,DESKTOP,62,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +RX+zW0CREKfkhK+golcy6Rcr3ic=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814506,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6930000,DESKTOP,16,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +lFcV7l8RGUCeXNLztqzNuP38EHc=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814512,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4450000,MOBILE,14,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +eQM4qYYjFZ7bNPaA45xGBQbh+20=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814503,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,3,0,0,19380000,DESKTOP,196,[CLICK],3,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +EjAdaDaQHB99A17PP0wGZMiF1nM=,2121450128,2021-05-31,2021-06-30T14:22:13.108,0,0,0,0,0,customers/2121450128/adGroups/123130090002,customers/2121450128/adGroups/123130090002,517571734739,SEARCH,customers/2121450128/campaigns/12872034134,12872034134,1,0,0,4140000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/123130090002~29554867064,0 +ORcCgtQCS3x0tSTC8OwbLQ0H+EY=,2121450128,2021-05-31,2021-06-30T14:22:13.142,0,0,0,0,0,customers/2121450128/adGroups/123130090042,customers/2121450128/adGroups/123130090042,517571734772,SEARCH,customers/2121450128/campaigns/12872034134,12872034134,2,0,0,9520000,MOBILE,5,[CLICK],2,customers/2121450128/adGroupCriteria/123130090042~19689304787,0 +O2RdbQQWj5uLSCJ9aMLpLz1p9XE=,2121450128,2021-05-31,2021-06-30T14:22:13.211,0,0,0,0,0,customers/2121450128/adGroups/123130090282,customers/2121450128/adGroups/123130090282,517571735012,SEARCH,customers/2121450128/campaigns/12872034137,12872034137,1,0,0,6380000,DESKTOP,4,[CLICK],1,customers/2121450128/adGroupCriteria/123130090282~39447438670,0 +5geOZqztFqAv9bmLJQF7v5dj80k=,2121450128,2021-05-31,2021-06-30T14:21:49.979,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,17120000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~312002208229,0 +wCh9A7/vTQyNvqwUH2/Jge5ZDIQ=,2121450128,2021-05-31,2021-06-30T14:21:50.007,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,6890000,DESKTOP,10,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~336544926909,0 +CT7zIpLk5Avs8jr62hp1O+Uhl2o=,2121450128,2021-05-31,2021-06-30T14:21:50.053,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,9140000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~489548954784,0 +ixGZ2/muZszBJ4epCcEc0z3FVbE=,2121450128,2021-05-31,2021-06-30T14:21:51.148,0,0,0,0,0,customers/2121450128/adGroups/99321637919,customers/2121450128/adGroups/99321637919,430843880058,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7210000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/99321637919~926646516844,0 +mddIGSs89XLnhR9PX6luN8wv2Eo=,2121450128,2021-05-31,2021-06-30T14:21:51.151,0,0,0,0,0,customers/2121450128/adGroups/99321638079,customers/2121450128/adGroups/99321638079,430843880067,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7310000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/99321638079~449404825186,0 +X2nI/QJndjpQGwQqUOn5A6E3rug=,2121450128,2021-05-31,2021-06-30T14:21:51.170,0,0,0,0,0,customers/2121450128/adGroups/99321638079,customers/2121450128/adGroups/99321638079,430843880067,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,6640000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/99321638079~509484669322,0 ++Uvfkuu1X0bb2shJJB/R7g4xcYs=,2121450128,2021-05-31,2021-06-30T14:21:51.241,0,0,0,0,0,customers/2121450128/adGroups/99321638839,customers/2121450128/adGroups/99321638839,430843880280,SEARCH,customers/2121450128/campaigns/9810839003,9810839003,1,0,0,7150000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/99321638839~449404825186,0 +EZeRxw3EqJuLwgrNjT9ujPsVinw=,2121450128,2021-05-31,2021-06-30T14:21:51.371,0,0,0,0,0,customers/2121450128/adGroups/100031226934,customers/2121450128/adGroups/100031226934,466828599534,SEARCH,customers/2121450128/campaigns/10059986066,10059986066,1,0,0,3350000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031226934~313277999221,0 \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_campaign_history_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_campaign_history_data.csv new file mode 100644 index 0000000..fa032f6 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_campaign_history_data.csv @@ -0,0 +1,101 @@ +id,updated_at,_fivetran_synced,ad_serving_optimization_status,advertising_channel_subtype,advertising_channel_type,base_campaign_id,bidding_strategy_bid_ceiling,bidding_strategy_bid_changes_for_raises_only,bidding_strategy_bid_floor,bidding_strategy_bid_modifier,bidding_strategy_competitor_domain,bidding_strategy_cpa_bid_amount,bidding_strategy_cpc_bid_amount,bidding_strategy_cpm_bid_amount,bidding_strategy_enhanced_cpc_enabled,bidding_strategy_id,bidding_strategy_max_cpc_bid_ceiling,bidding_strategy_max_cpc_bid_floor,bidding_strategy_name,bidding_strategy_raise_bid_when_budget_constrained,bidding_strategy_raise_bid_when_low_quality_score,bidding_strategy_scheme_type,bidding_strategy_source,bidding_strategy_spend_target,bidding_strategy_strategy_goal,bidding_strategy_target_cpa,bidding_strategy_target_outrank_share,bidding_strategy_target_roas,bidding_strategy_target_roas_override,bidding_strategy_type,bidding_strategy_viewable_cpm_enabled,campaign_group_id,campaign_trial_type,customer_id,end_date,final_url_suffix,frequency_cap_impressions,frequency_cap_level,frequency_cap_time_unit,network_setting_target_content_network,network_setting_target_google_search,network_setting_target_partner_search_network,network_setting_target_search_network,serving_status,start_date,status,tracking_url_template,vanity_pharma_display_url_mode,vanity_pharma_text,name +14432604647,2021-09-01T09:21:46,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604647,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,O2aBk1MBJq48WpSF/o18SQ== +14432604650,2021-09-01T09:23:13,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604650,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,OGBKBzE1Kk+kWe5Ktya3Dg== +14432604653,2021-09-01T09:23:15,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604653,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,DgyvOij7pu6daVAQVKAiSA== +13394597236,2021-08-29T06:26:50,2021-08-29T14:24:29.907,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597275,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597236,2021-08-30T07:20:19,2021-08-30T20:21:44.203,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597236,2021-08-31T07:17:17,2021-08-31T14:22:54.717,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597275,2021-08-30T06:23:01,2021-08-30T14:23:43.169,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597275,2021-08-30T07:26:05,2021-08-30T20:21:44.210,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597275,2021-08-31T07:17:17,2021-08-31T14:22:54.718,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +14432171240,2021-09-04T02:16:24,2021-09-04T14:27:24.989,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,14432171240,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,15N+CHN1U9fezwcOilbxoA== +14432171240,2021-09-05T01:47:30,2021-09-05T14:24:36.918,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,14432171240,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,15N+CHN1U9fezwcOilbxoA== +13394597401,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-08-30T06:23:01,2021-08-30T14:23:43.169,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-08-31T07:17:17,2021-08-31T14:22:54.719,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-01T07:54:51,2021-09-01T20:21:48.138,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-02T10:23:26,2021-09-02T20:22:28.858,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-03T10:56:02,2021-09-03T20:22:27.458,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-04T12:34:07,2021-09-05T02:21:52.938,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597410,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-01T07:54:51,2021-09-01T20:21:48.139,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-04T12:34:07,2021-09-05T02:21:52.938,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597413,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-01T07:54:51,2021-09-01T20:21:48.139,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597416,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-01T07:54:51,2021-09-01T20:21:48.142,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +14086723368,2021-08-29T06:26:50,2021-08-29T14:24:29.913,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-08-30T06:23:01,2021-08-30T14:23:43.190,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-08-31T07:17:17,2021-08-31T14:22:54.724,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-01T07:54:51,2021-09-01T20:21:48.146,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-02T10:23:26,2021-09-02T20:22:28.879,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-03T10:56:02,2021-09-03T20:22:27.463,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-04T12:34:07,2021-09-05T02:21:52.942,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +13394597419,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597422,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597425,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597428,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597434,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597437,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597440,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-01T07:54:51,2021-09-01T20:21:48.144,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597443,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-09-01T07:54:51,2021-09-01T20:21:48.144,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== \ No newline at end of file diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_click_performance_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_click_performance_data.csv new file mode 100644 index 0000000..c90ada9 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_click_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,criteria_id,date,external_customer_id,gcl_id +6R2pKfyVIlplWFrmSMEjTdb7Lg4=,2020-10-06 22:13:10.831 UTC,p6zp17DVJVjAD3VAr1btVw==,107253667331,G+b561Y/O/hceLQhm/Cd6Q==,enabled,10121482518,f+NTeTOsnxPzAuGNT9eQYQ==,enabled,1,336544926909,2020-07-08,2121450128,EAIaIQobChMI5KWC0aW96gIVCZzVCh2ZQAcnEAAYASAAEgJBwvD_BwE +ny5pgpTV/5vT6RhUuFZUbW3r4Kg=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893863172,bYq4SJQTdWsa9r2ra4CGPg==,enabled,9935249277,2tzxA1l6Ptm/4RLBmRS+1w==,paused,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLrBTGBvN9DgQVyYN8z-51i3heXdWZ0f1POR-ZEkP5lcH6FHOx2_IMaAumHEALw_wcB +lrsPJ1JB1x0GyZRN5OOFRay0QnM=,2020-10-06 22:13:10.559 UTC,p6zp17DVJVjAD3VAr1btVw==,100031227654,cyHII+mGcUpsI+9j29woWA==,enabled,10059986060,Xxz8EaV/WN0fSpW/YDAZpQ==,enabled,2,19689304787,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZI4NBFyroqj9GvKKABn6CsY8jLYVa-bY0N3XKcMihnXENYafgsHRo8aAoEQEALw_wcB +VS9bToG/sOowwsEOmRVQrub8zT8=,2020-10-06 22:13:10.442 UTC,p6zp17DVJVjAD3VAr1btVw==,105484729354,7fFDkHWoOkR/uLYw3cnI3g==,enabled,10266487352,BcfGmjNq/QzyOOkely2k4w==,paused,1,509484669322,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLypa25WHwLrEHRpTDMYOGnbXawB398vj21q1yNShRd0DHRk7DAXtkaAgHjEALw_wcB +Yh3++FAL6LW3b36K/eAxhzAsK5k=,2020-10-06 22:13:11.123 UTC,p6zp17DVJVjAD3VAr1btVw==,105484729354,7fFDkHWoOkR/uLYw3cnI3g==,enabled,10266487352,BcfGmjNq/QzyOOkely2k4w==,paused,1,926646524284,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJPGlCSMuBJ2wmBRz0NYbQydZDlQo3e0qKapLN_PxR0JaeRdYG2EKgaAinYEALw_wcB +9JfzoLxqWWh0VMjlzh2iN4o9N9w=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,336544926909,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIJUlRXhLBoV7FQGxzUImJr-sX4ZOTBhjwl1GlOjwGoQTlimOxJvRYaAhRDEALw_wcB +FCe/Na1OM7qFufFW4FR1+teYiuE=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,410613989703,2020-07-08,2121450128,EAIaIQobChMInsL6y8O96gIVCtZ3Ch2HGg9rEAAYASAAEgLZ8vD_BwE +uYVycfyzkaoFb/LnVirQGKZxsXo=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,336544926909,2020-07-08,2121450128,EAIaIQobChMI3r6pruS96gIVC7wYCh19MQo-EAAYASAAEgJN1PD_BwE +rH3hAHzXJiMLDVR6uA0D8S+C3o0=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJbfLFLHq2HjPyspqfHnBKlQCfVcTUfl3XZEOTzjn8aWkF11W40eVAaAjS3EALw_wcB +mGzuj9v/WtViL8VLITZeGJf2WiY=,2020-10-06 22:13:09.204 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMImZOy8Yu-6gIVfMq7CB39cw8iEAEYASAAEgJ2mvD_BwE +GW2OjP72mzVGJFCqmxzk9keVP5Q=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMIoIa2--O96gIVFN7eCh3klgl4EAEYASAAEgLmP_D_BwE +Q/gGFUvktNC/CmUC819Qs21fTO0=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMI1_qxvPa96gIV0C_TCh3ojw0mEAEYASAAEgIUS_D_BwE ++Tp0TXX4ABg5v573FIhdPOrd4WU=,2020-10-06 22:13:08.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,492207998548,2020-07-08,2121450128,EAIaIQobChMIiPHasvW96gIVySMZCh2gJQV1EAEYASAAEgI2A_D_BwE +ruTdGynVMQ7om8Wcpw6xwILl1W4=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMIo96DxfK96gIVBJMYCh00JQluEAEYASAAEgJwXfD_BwE +vlvwhCO0gh5/BlFvAyTxybXMAC4=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIS7_z0Crn5l0zTLYjH8XKF9M53_GC7oMtMw2hEK75ybe1V3GZgxr4aAugVEALw_wcB +jvpVtQs1plo3j6UWLWW/Xwq1knU=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMI34uu2IK-6gIVnOS7CB1BoQCBEAEYASAAEgKsFPD_BwE +ywZK+X92xBhHNu2VuUDUCIxg4q8=,2020-10-06 22:13:09.204 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIje2i6J--6gIVjvJ3Ch2kdQyVEAEYASAAEgJSnvD_BwE +kZCZqnvyFU8hpj6fhULIi9UlLjE=,2020-10-06 22:13:08.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,492207998548,2020-07-08,2121450128,EAIaIQobChMI8p_Hnca96gIVpBCLCh1IeA5iEAEYASAAEgJKcfD_BwE +vpN2pKJnuEk6Obk/AHbH1MnvTVo=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIlsqFkuy96gIVVTTgCh2QFwJOEAEYASAAEgId9vD_BwE +eimVZpZb20xBjYJMy9/7h7JFJTw=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMI2aDojdS96gIVD8iyCh3QRghmEAEYASAAEgKRtPD_BwE +E1xUSo+xs/tqaRcEEBdAadKm7V8=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIxufatNq96gIVScy7CB0EHgTwEAEYASAAEgIecvD_BwE +wel4W4JvyuGIU6yjbJ8NavlGflk=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLgZ6Z0kotatfgBMkHvrp6E5WAaeAUznTZV_Xm5_UyKrbEhWMV_iEEaAowFEALw_wcB +SMWu6uDsSHmLc1OwtCne0tfwRPg=,2020-10-06 22:13:09.412 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI-a6DxKK-6gIVAz6tBh30gg25EAAYASAAEgK6MPD_BwE +m5z+qQ7K8qWjsrZpe+/71mRwk9A=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI0N7Fie696gIVjYbACh1W4wovEAAYASADEgLAB_D_BwE +riMtJxsujsT3/LKbGYTmViFU1Oc=,2020-10-06 22:13:09.206 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL46kNN8_PPgPI-P2TDyJgLBxAFi5XncrTGKvMeWkVvHRFAq5XscZsaAhFtEALw_wcB +Wsp0szZJBJWoK+cYkGeAToFw88I=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIi5nU7oK-6gIVjx-tBh3XHwNWEAAYASAAEgI7nvD_BwE +ORZffDG24Xatkn/LsWVK95XmLCA=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIzfPP2_m96gIVWz2tBh3n7QkZEAAYASABEgKIlfD_BwE +nILqpn+aCTOyOTaE3pl7kHfThaA=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIzJjf44i-6gIViITICh3nUA5XEAAYASAAEgIKnPD_BwE +iZaTJ2TJrp1tckQ6PwaOAT0yHRk=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJI6-s0I1NQdtC3Hrs-DBjuBHYiKqGY3ZeM8R0qX_FKOhdUlVKQ5ygaAm57EALw_wcB +H++ypyyGdmKr5aBKnd1DZRgl4p0=,2020-10-06 22:13:09.412 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKKN941dfP0cx9_u-X27YwMgonDHoMxfRKTb_Z6euYNL_DD2aLI7CMaAg9xEALw_wcB +HBQ338fj+DXo6pue9wt/++SR6hk=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZK5WsyhWALdrFqKcA3LDyNjIBsTVBcRPwSnLtD_HHUPiYZabxrMkWgaAv4UEALw_wcB +H4KXOwf4wex4Cp/1E8ALZJYEYhI=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIlpHUxaC-6gIVS7LICh0APgl7EAAYASAAEgJUc_D_BwE +ZXCR0xR6uTGuUgapYsv8hC4Qids=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIqqPykpy_6gIVdh-tBh2RwwxWEAAYASAAEgIujvD_BwE +TKLou8i8dNYVxDHQTGEce4HvpeY=,2020-10-06 22:13:09.404 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIi5nU7oK-6gIVjx-tBh3XHwNWEAAYASABEgJE8PD_BwE +Of7QlppKk+T6zficLCBO38wwXv0=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIvYjRzv696gIVEQnnCh0QEgNWEAAYASABEgIfdfD_BwE +BZiwpdbiV3Kaq58XHwkkaP3bOGk=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKVjUNzguVOR0PpmGGGHceSemWEKr_tWD1DzvFhCjqPBLEsxS6JEBwaAtz2EALw_wcB +jJhMn8NgQXPYBRg+lCf8Tmop1lc=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIh62lmua96gIVjcDACh3ARQuTEAAYASAAEgJ7B_D_BwE +GA3RExUwPMoy6yVyCmvCbyg/vdk=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIqPmw26O_6gIV7D6tBh2cVwNtEAAYASAAEgJQDvD_BwE +KvFjbMaXup3DaM9uZB6/GzqBIiU=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL_-SyEe9JHtqfqSqPZq6xlfsGa-CwMkJqaEJoNXdiJy7PY4yWmRLIaAtiBEALw_wcB +jFN294EqQkUHuPUOF3EIC2aPfaM=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKdRSxl8HqYVbq_1-T2QIA3Imn9hCpLwiFgEAKj5zd_MpQP05xDFGoaAmQ1EALw_wcB +i3SeFSKW+V/IPEe2tRBw3KvYSyY=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLLFvQP33bqbAU4pMwk4n9ynUOSrzShojRrd1tJWxGda8gQ_ZExacYaApESEALw_wcB +1It6hROez5/Szc7ncMFmdnwLjhw=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149592141,2020-07-08,2121450128,EAIaIQobChMIz9mwwJK_6gIVUtbACh2xxg2aEAAYASAAEgIIpPD_BwE +P0Iq4J+F5wx4dXVLH298NSTgwRI=,2020-10-06 22:13:09.409 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIurDk7pK-6gIVA9bACh2-lAxSEAAYASAAEgJMAPD_BwE +ToTKtf/dvRT6WFD0tkVIMbnHU8w=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJ1YIVsE8sjrkKT6ju5Ik5ybb7f3Uyjt1ufSsljXLej3JW4sSfZOZcaAssHEALw_wcB +QcYZnMhG1XSvcow7Z2zWXaHy514=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIpuCYm6u_6gIVT_DACh28yAReEAAYASAAEgJETvD_BwE +WGo+XxQrgNkVvps9Yh/NI9J7Oak=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI4OmPhaK-6gIVB7bICh0IcQ6rEAAYASAAEgJrT_D_BwE +6mEEx3ewUAYy3xsTHL+uDtYcdFI=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLmfarLDVkzrgS6mZw7Sma37KeB1NgAewyLGst0Lw-Ejd3RON2tsJ8aArsgEALw_wcB +Ju9VcCB85qpYHGiiHtf7/VgyOB4=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIlpHUxaC-6gIVS7LICh0APgl7EAAYASABEgJhKfD_BwE +Y51In/kEL+I0Q3Yg0edw6zwlEdI=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLp40eStu52LtDNtgIdFtiyluZ0ZXb9bkujnhOBUvECdf__HgsSEiMaAjY4EALw_wcB +ggsdMhIk9Ev9YtoLhPFu1ymHN30=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI1NbOkpm-6gIVhcDACh1GGgqKEAAYASAAEgK4t_D_BwE +Wzi+6qkvn60Vu3FIFkfRhzyvYXQ=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIltz3k5G96gIVi4bACh10VAzTEAAYASAAEgIsafD_BwE +CoQoQFce2OH3zvOZ9XFcB3fhYok=,2020-10-06 22:13:09.408 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIwbyp2pG-6gIVCbSzCh3McQsyEAAYASAAEgJaQfD_BwE +DVyE2D9PPgZ4AnHltCqT9nSq+dE=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIyIOuo5u-6gIVC77ACh1ZVgSPEAAYASAAEgLAePD_BwE +7Sjx0A0F/O9d0fJli8sqhi7U93c=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKIviwuqhh2jn5IEtAH50vOuEpJP3ufNH7QT10FOY9jIk5UipuBIgkaAhC3EALw_wcB +5a9FxrrHkCiZvAHhbGFZtbNWWLo=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMI-tjlpKa_6gIVsCCtBh1tmQqoEAAYASAAEgKmjPD_BwE +z0LdOnlb9k6uCJn3h3tbt+UnKwE=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIHg-ChW4_Jyiuy_OyDFIksRLaBQQiFnBjlUm3RyLCLqN0pK6X7YboaApuZEALw_wcB +F1DCTlZpYgRf3QnG8yTTkPEmf8k=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZI_-U8TO_xGAbA2VuGZtcaY80Xu8-h65l81IT-Tm73Wkc-lHL2KckMaAreyEALw_wcB +dGw4NZ0LgqaXLzWdRvnM2oRIQcU=,2020-10-06 22:13:09.409 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMIrduVy5K-6gIV7D6tBh0ieA2UEAAYASABEgLPOvD_BwE +1FqBVw0HeV1oIhi5A/NWGxvdJuk=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIoYvu9qC-6gIViZ-zCh0mgANhEAAYASAAEgIaBvD_BwE +78BN0J+z0GU5y0aOwuhkCQhq494=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIr4LQv4y-6gIVvj2tBh3wGQmAEAAYASAAEgIEYvD_BwE +bxV2FXJbvV6gsRJvotU9Ecmlxm8=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLrrO0UwcYkDOuE5YCR8P5852rCOS9WUp00dTmFfCc50zE6BVITWtUaApbTEALw_wcB +cWGMyEK6WW2EKkR626uL+oLo9jo=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL4pbAafo4T6A69KDO-_BmQNGIIFS3L4YMvTkn0KBBfcqXDeeiA0DUaAlDdEALw_wcB +pSCY7vOrUZHisRGAUZjemn0YG9Y=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZK2Bihj4ZDtkoDlTQ09WR3OyNLl-lTe3G5n78fv9sjclCd4m1fTpUMaAhqdEALw_wcB +6rdroM9Zvdr/yoISn/5NOGusdYs=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149592141,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLNxFC_xPrnSm60CjDYlfWiZgK6hJpA5RpAlaI-Z7-Oo6yZXmOPP0caAstFEALw_wcB +LrWXJRAhWucreoXCj1YfN5dQ26g=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI47nW_-696gIVCYTICh2W2QkLEAAYASABEgI76fD_BwE +ynjajCIZDk+q1gRH86VqmKYFDzc=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMI5cufnZ2-6gIV3QiICR1MCQm9EAAYASAAEgJqafD_BwE +H+/XUZ2+0Fl0qgZGvr4WxitDcqg=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJbZmBFwVyEnPqG3jljaQj1fPG2AU3GsX1nVQA96b2PrVb1k8XcJYMaAu4KEALw_wcB +nkRfaw8OokLfE4bIjZXDpYa8s50=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLlZU0WsTVvZqR6Ix-f8xvFsbSuOry-sCqKt3TghaseRJWQjk3U6SkaAmWfEALw_wcB +K/rUvMOmUp/MakpG7dpomxHcKtU=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI0djVvdS96gIVD77ACh3TpwvzEAAYASAAEgJymvD_BwE +h484V/IiG+FBfzSnDIIUC4JL634=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIoZezurO_6gIVzz2tBh3-MQneEAAYASAAEgIuFfD_BwE +1ELqmNmwgq0JcyhltypaxswZp0s=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJKsbQz9TxgUEhRogYI08-8hejoywWjUo3T_kiogX_exM8E3Bs3kMwaAnioEALw_wcB +xRcesxdin3xLoll0MALwq0zt5Qk=,2020-10-06 22:13:09.405 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIxabntgqiWNwjzQ_xxyXgbYLiCSK13aKtAcgMTbU8mS_Pl7NHwmVAaAln7EALw_wcB +IrKj+pDgOHDmTrIEYo2U1cMbNDk=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMI7vLKhvq96gIVDQiICR1iMg_UEAAYASABEgJ7IfD_BwE +F9sMaIb0PotH6TlrpKDWynmS5+k=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIE-fuhioCFsX9UmGTlFjwfXw9Pde3vPrhILdesPd_5CC0RXJOTn7IaAvqcEALw_wcB +SfSD/lV2d9sHBpTUaqcWxtiUsO8=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJv55bs89NM64tBN4XGSNZ_-DWtGyFbl52YYcPfCjOogqLjDjsEaH8aAn9AEALw_wcB +eE3JJqqQoIFygYsLg8p++ey2R1U=,2020-10-06 22:13:09.206 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI293nqJ2-6gIVUD2tBh2uVQDlEAAYASAAEgJQg_D_BwE +wO3C313rEYMMqod4Dx1oAd4P9/0=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKELEgafWvQrfNmKKddGYFGwZBFB4ThEEG6xi8YxANJtSKizW3N6J8aAjU3EALw_wcB +jxeR5li02ZarnSLolAr4IwD6H6c=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIusbQ6pa-6gIVFqSzCh1qDAW3EAAYASAAEgI8WfD_BwE +dHpEIIqgfrRxr8jOMhS1WIkwujs=,2020-10-06 22:13:09.408 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMI1cjB85C-6gIVz8DACh2GDQLBEAAYASAAEgIXmfD_BwE +yAi9zArMPUJ/ej+dxPba20xOV6U=,2020-10-06 22:13:09.404 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKI9ccpuAyRKQdKmA5pxo-HKAw9vm6jQhCHeqSYkxDjKgIpe2SW8dUaAif8EALw_wcB +fh8x1EyYl9JS2XVY7o9cIghuB/w=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIsIOhwYC-6gIVVh6tBh2WMQBdEAAYASAAEgLMtfD_BwE +vs7+QziQq3kuwwen7FUE1Ls9E44=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLMqIvT7zRklc69kKdlwEPVjzn401-4R74lVaAeresg_S3zrVdwpdQaAnvUEALw_wcB +9GER+Pwzm9Ow9xQ5RMOnE575Gbc=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLe35dQZpVmpuuVJ0lAXSFySlb5Krr1x9ZJUt3twCesZ5eV4UEUlMMaAhRDEALw_wcB +3Ufx+3mfvBA3Zyx3Y8wjaqfmP1M=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMIxK2fk6a96gIV2uJ3Ch0tAA0XEAAYASACEgIO5_D_BwE +xznELOg1Hz3LY0P+BpDL3CQsHTE=,2020-10-06 22:13:11.096 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMI_vGOkbu96gIVkuF3Ch3RxAgBEAAYASAAEgKaufD_BwE +jeXl7MK94rWv26G274yXLJVcV1w=,2020-10-06 22:13:11.102 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMI7tii_IW-6gIVzOeyCh2ZegwdEAAYASAAEgIXVPD_BwE +fV+zFKVZRCclVV2ksmt2EwMh17I=,2020-10-06 22:13:11.103 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKPd-xKdOQ-llv9L6ktLQO4SdpPhURvjcMkyn9RwNMMfyBGI7cUiBUaAqVHEALw_wcB +o1w1X7WTJPO0NXR0AHeCaEdKBmw=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIr7GFKKq-TtMtQALqS0oK86hsT88oObF4su6GXnNdZKGtJv35hp5YaAta5EALw_wcB ++i5KkNPUbiFLkTup0IrIpILGRQs=,2020-10-06 22:13:11.102 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIIWeuwJzb7Hq3sKeu0UeCzoNMiWrRDebK_peXgC9tVJLMZPPrswpUaAkbGEALw_wcB +HNsOKIHXRZac6XBHyv1Tz4bdKaY=,2020-10-06 22:13:11.100 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,2,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIJcuKv3yE_UQ26DA6sEF683eLI5M0ZYwtKgbpPRRiemW7d7pWef74aAiTvEALw_wcB +CaH/TwkgwkDtQHsqtx1vuDR54zE=,2020-10-06 22:13:11.104 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMIl_rfyby_6gIVkql3Ch2oiQBFEAAYASAAEgJc6vD_BwE +RvgD8Ov2oqxPTA0B1fdrk8bElXc=,2020-10-06 22:13:11.103 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZInIKMCyuodFljmvQOWJXKkJbFE4IfmTf_GK8rMWz6Ap0jDrYlLXq0aAoa-EALw_wcB +SG/xQ37foid74/bpIGZUO+1PxT8=,2020-10-06 22:13:11.101 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLwa_kyJ-R82Oc3t8gZFk8flHc99wI18vMTo1OCcDXydihsh3w7Va8aAkTOEALw_wcB +SIqKPQIrm3Nah6BapFdHTJpbhHw=,2020-10-06 22:13:11.099 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,EAIaIQobChMIwZfzv-u96gIVWYXVCh0eSwe6EAAYASAAEgJWrvD_BwE +8SdJHBG7lqr+leOyVZyTtm6Ptv4=,2020-10-06 22:13:10.431 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,387293813655,2020-07-08,2121450128,EAIaIQobChMIs-iM95u96gIVAuDtCh23VQyIEAAYASAAEgLzxfD_BwE +iLb9XsycnJhdChNr/s+MfToUuuM=,2020-10-06 22:13:11.097 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,EAIaIQobChMIgLvNsb-96gIVxOR3Ch2wjgJYEAAYASAAEgI1tvD_BwE +TX3V98uPvfNHihyVjTeWmjr2Hoc=,2020-10-06 22:13:11.099 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIMdbb_eYG0rs9aPZhlzUd9D48Lyxiv44TkzVDr8lPmkX4aQ_nceWcaAorgEALw_wcB +SacRo6goy4prP6RCHmdPc+KgPCE=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLdUD0ewZuzm5EZAwFtnGUm5UtOK2eeMdeK_VioS2yqW64VirhnUIwaAu7dEALw_wcB +KHxYOjOpbHHCGWCLSdX+4xcTwz4=,2020-10-06 22:13:10.431 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,916298298903,2020-07-08,2121450128,EAIaIQobChMIn76W76296gIVFOh3Ch3ZKwwvEAAYASAAEgIyN_D_BwE +I+cICapUPHnvLVz9cgFrTT6YSPU=,2020-10-06 22:13:11.100 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMItMeI7vC96gIVDdOyCh2GPQNMEAAYASAAEgKt7PD_BwE diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_criteria_performance_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_criteria_performance_data.csv new file mode 100644 index 0000000..76540b1 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_criteria_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,cost,criteria,criteria_destination_url,criteria_type,date,external_customer_id,id,impressions +EoTsmOaUS75SUc+Z65Sg/mQlWDw=,2020-10-06 22:16:20.560 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-14,2121450128,1705907456,45 +hCgjxps1PhouWaYDn4y+BBYoeJc=,2020-10-06 22:16:20.561 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-16,2121450128,1705907456,33 +CNgESh9K2FLhFZOiKVIX1LOV2pc=,2020-10-06 22:16:20.544 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-13,2121450128,1705907456,27 +UZ+eznARIcS37lf/6Ay8zp2ky3w=,2020-10-06 22:16:20.561 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-15,2121450128,1705907456,123 +3MY0Q+vLeIe39bK/qBA3Ps7SRxc=,2020-10-06 22:16:20.559 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-12,2121450128,1705907456,46 +V3rf4nBMuer+hTlHRMx06SK7VeM=,2020-10-06 22:16:20.543 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-11,2121450128,1705907456,7 +4rjICHkxAvLlj+BXBo6AnahxtU0=,2020-10-06 22:17:07.009 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,12.35,+bigquery +postgres,,Keyword,2019-12-05,2121450128,1030451960832,7 +iS2AhmTgMhAHD3kQLbN5hTKAjxI=,2020-10-06 22:17:07.040 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-12,2121450128,1030451960832,15 +JvjcOBIv7nPgzXLnUCj/8VuBCvM=,2020-10-06 22:17:08.021 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-31,2121450128,1030451960832,10 +W7jh6ttbfXnGx4SuJqBIrsqb7vg=,2020-10-06 22:17:06.846 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-21,2121450128,1030451960832,18 +AOo5iO9hafCXcSG2UrZFRVtAiVc=,2020-10-06 22:17:08.044 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-30,2121450128,1030451960832,6 +QW97keCFw4NqBjQhNhMXqw1hi1g=,2020-10-06 22:17:07.006 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-03,2121450128,1030451960832,12 +C1i+t4zd+Gt2aEv2tvyt7OncSWs=,2020-10-06 22:17:07.002 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-01,2121450128,1030451960832,5 +R51NBeR4Z6RkDCEqIeX2G1G+ikY=,2020-10-06 22:17:07.994 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-21,2121450128,1030451960832,2 +RQP7r5YjpcLMIuM6DIZ/Ws+2MTU=,2020-10-06 22:17:07.971 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-19,2121450128,1030451960832,9 +HfHagX6uRl2IURWWrs0uGr+YysQ=,2020-10-06 22:17:08.005 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-24,2121450128,1030451960832,8 +Jn+Zh34Hq9EDpEkMwr0ue6SKqYc=,2020-10-06 22:17:07.050 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-07,2121450128,1030451960832,4 +Pyc0iF+t4Hho4RRbvoo/53TllNs=,2020-10-06 22:17:06.845 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-20,2121450128,1030451960832,14 +cIOCRURlZKe6BD9IGlyX1ToNyXI=,2020-10-06 22:17:07.051 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-08,2121450128,1030451960832,8 +YSIDmsXXDY9d9BKYlaFMVfrES78=,2020-10-06 22:17:06.999 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-28,2121450128,1030451960832,2 +A6x7FPWdLthfG0J1OQ/oTsqcKyM=,2020-10-06 22:17:07.041 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-13,2121450128,1030451960832,26 +KG3x/z7sdAlFGxiWfIFB9iP1NA0=,2020-10-06 22:17:08.012 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-28,2121450128,1030451960832,8 +b//0BRE4NYPrlvh9sSBCtd3ls3o=,2020-10-06 22:17:08.086 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-12,2121450128,1030451960832,2 +VhmkeHFxpNvjNwluy3iFA/gFk6M=,2020-10-06 22:17:06.867 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-27,2121450128,1030451960832,13 +FQpyqZk8k6anIHPjNGMmUBcIKl0=,2020-10-06 22:17:07.042 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-14,2121450128,1030451960832,4 +za6J1an8gsmKTmfdspMabQJYL8I=,2020-10-06 22:17:07.072 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-16,2121450128,1030451960832,18 +vEJO2FJoy43oe5Gl3h4EzCcUPc0=,2020-10-06 22:17:08.088 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-13,2121450128,1030451960832,10 +gs2GaSm8ONQMqI+h1PMDWX3gOY4=,2020-10-06 22:17:06.978 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-02,2121450128,1030451960832,6 +KJOs5Cmbi9KeQoKoku8u3EMkpYE=,2020-10-06 22:17:06.856 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-24,2121450128,1030451960832,6 +2v//zWlwswM9odEg0EcDVxmo2Rg=,2020-10-06 22:17:08.004 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,11.85,+bigquery +postgres,,Keyword,2019-12-23,2121450128,1030451960832,11 +5ccM8c0HnSCliZ9G+bk7RI4tcc4=,2020-10-06 22:17:07.061 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,12.14,+bigquery +postgres,,Keyword,2019-12-11,2121450128,1030451960832,38 +b+jr1S/r9EMYRg0n/nwSMac5gZ4=,2020-10-06 22:17:07.976 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-22,2121450128,1030451960832,5 +KeDvaNjk+/HFHB7yDihhJOT29w4=,2020-10-06 22:17:08.022 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-01,2121450128,1030451960832,1 +Fdnc/7MycXSHdoujKC3G8SpkEYo=,2020-10-06 22:17:08.976 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,11.81,+bigquery +postgres,,Keyword,2020-01-17,2121450128,1030451960832,21 +lzTKfqEC+UrP4+tVM0T/NKJawFQ=,2020-10-06 22:17:08.032 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-03,2121450128,1030451960832,6 +9H+kqHIaaAO8QvAh8k8l+5/87aI=,2020-10-06 22:17:07.973 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-20,2121450128,1030451960832,9 +kAyo2wfc6KqhQaoIy4zq7KmeRBI=,2020-10-06 22:17:08.095 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-14,2121450128,1030451960832,3 +qk/KRGOvClwHv2MsC8L5q4aNtTM=,2020-10-06 22:17:08.035 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-27,2121450128,1030451960832,6 +j3AYQiFvB/kDhyp9iqtXFJMltsA=,2020-10-06 22:17:08.099 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-06,2121450128,1030451960832,12 +JNxZUb138pKQfi0hdjQElROUmik=,2020-10-06 22:17:05.461 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-14,2121450128,1030451960832,1 +Sm2tG0phnJTWfpcS8Eas7bR+9n4=,2020-10-06 22:17:07.001 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-30,2121450128,1030451960832,1 +OxMIYkY+eOsH9ypZfCHlrul1/EY=,2020-10-06 22:17:06.855 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-23,2121450128,1030451960832,8 +P0dY5o8KoCYqv1QvKJknX/sXN/4=,2020-10-06 22:17:06.866 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-26,2121450128,1030451960832,6 +1tTV3EqY4TbwsFavurzKhusB+4s=,2020-10-06 22:17:06.853 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-22,2121450128,1030451960832,8 +p6yueZtkUD8yaHkJGK0FJIrE2qM=,2020-10-06 22:17:07.983 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-17,2121450128,1030451960832,10 +eYWJa5pMLbjw2zbWrtSauEKHjQk=,2020-10-06 22:17:07.018 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-06,2121450128,1030451960832,9 +eX5PIRrvXD9dRgGkzLZ/YflfoJc=,2020-10-06 22:17:06.833 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-18,2121450128,1030451960832,11 +gBMNzEsmvr2TKZxR/fTLNdknscw=,2020-10-06 22:17:08.098 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-15,2121450128,1030451960832,17 +HwS1nvMmtV1iht4ox4Fa5uFz7LU=,2020-10-06 22:17:06.989 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-04,2121450128,1030451960832,4 +Lalzxv/AUXQ9HMp3LMBxYBbLHYM=,2020-10-06 22:17:08.974 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-16,2121450128,1030451960832,9 +DqmjbkRl1mF9rUk7EOvBxYhppmI=,2020-10-06 22:17:08.978 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-18,2121450128,1030451960832,5 +5JzGipiOhFxCvjUvP++ImJ7jjxU=,2020-10-06 22:17:07 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-29,2121450128,1030451960832,5 +qGCx9Sx2Wl+i6YMHhHG3njDEX/M=,2020-10-06 22:17:08.024 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-02,2121450128,1030451960832,10 +ChAyW2hgkIKvh9Pe3LVlmPUqt4Q=,2020-10-06 22:17:08.106 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-07,2121450128,1030451960832,14 +11pmkAzdwpizcUXq+9OCAZfvSB0=,2020-10-06 22:17:08.110 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-09,2121450128,1030451960832,3 +wSz/tJLrQtoiybyP1CHhxVnZMZs=,2020-10-06 22:17:07.048 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-15,2121450128,1030451960832,1 +9RSw5WriEq3FH0w39OZP+8YnIDY=,2020-10-06 22:17:06.864 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-25,2121450128,1030451960832,19 +8BzBPV2Ap9vX5pOP75ey+pgYPb4=,2020-10-06 22:17:07.981 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-26,2121450128,1030451960832,6 +T5Ls06Ju7aSKpU5Q9S7RXt7XCEo=,2020-10-06 22:17:06.843 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-19,2121450128,1030451960832,27 +nBT+pseNR2wv/UoNVLGKORVgfIU=,2020-10-06 22:17:07.028 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-09,2121450128,1030451960832,21 +fEUNC5fzH6uy/jLi8DxYHyiGqoM=,2020-10-06 22:17:05.520 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-15,2121450128,1030451960832,2 +nEs5PNezROLC4W034tjW4XIcksQ=,2020-10-06 22:17:08.075 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-08,2121450128,1030451960832,14 +6hIs3Oeppk1AvTkYxttGuDB34QE=,2020-10-06 22:17:08.013 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-29,2121450128,1030451960832,3 +3UbbOcAEyghV4w+Lsx/UthLzWGE=,2020-10-06 22:17:06.831 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-17,2121450128,1030451960832,1 +m0LQBQeIgx3BR2nZH1sijETLwzg=,2020-10-06 22:17:08.007 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-25,2121450128,1030451960832,3 +/DSfNzJTqqpGwjmRlCY2SVplkt8=,2020-10-06 22:17:09 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-21,2121450128,1030451960832,7 +0wPOOGEWMWHimc1ZmhEWbWfF/Tg=,2020-10-06 22:17:08.997 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-20,2121450128,1030451960832,13 +WNMyMH69xGppRfQXp9RwULcR7l4=,2020-10-06 22:17:08.979 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-19,2121450128,1030451960832,3 +cF1v3vkSYwVRqo4FEaXGHrj9ccY=,2020-10-06 22:17:08.065 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-05,2121450128,1030451960832,1 +GLm8aqVzA/a1f7iuc8ONRILYtV4=,2020-10-06 22:17:08.079 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-10,2121450128,1030451960832,19 +O4NhF2GM1XI0YUInliBkZ1YfwDo=,2020-10-06 22:17:07.984 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-18,2121450128,1030451960832,12 +31eg9eWQHpe/97O4J/478SeTxik=,2020-10-06 22:17:07.054 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-10,2121450128,1030451960832,11 +si7iwWqfasw7oM71Gb8GoEA7/T0=,2020-10-06 22:17:09.001 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-22,2121450128,1030451960832,9 +UJbXBkMdVET/UIEs91VZwNGkrI0=,2020-11-06 14:21:38.458 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-12,2121450128,930331198976,1 +VX3OxXsdb2tcfymtpuXuo3QORVY=,2020-11-06 20:21:00.955 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-04,2121450128,930331198976,1 +HazDNaz3z/tCjXyh2M9FxTL0rc0=,2020-11-05 14:21:48.625 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-06,2121450128,930331198976,1 +APOQ7umVb3klaq7W9pLB0mYT6t8=,2020-11-06 14:21:39.219 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-23,2121450128,930331198976,1 +VXipp1OrgkpC8UUZ969wmKl/wbU=,2020-10-11 14:21:17.574 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-11,2121450128,930331198976,2 +iKIZeDU6l4iWvGyIwLeWsQHHx6k=,2020-11-06 14:21:39.631 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-29,2121450128,930331198976,1 +6vkm3xTQXj+YnWDYcxjwN86JpYw=,2020-10-24 14:21:13.759 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-24,2121450128,930331198976,3 +YwGARDsvJ8zQwKlkVcuwoE4F44k=,2020-10-12 14:21:17.606 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-12,2121450128,930331198976,2 +PodzW5f+VT7XsRLmgZeWmvd1SlM=,2020-10-31 14:21:28.326 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-01,2121450128,930331198976,2 +sljqvnsmFo5Xr6/v2Azw2qz94T8=,2020-10-09 14:21:19.108 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-09,2121450128,930331198976,1 +Y6L+tLfEg7ugcGMgNRo23Iveg9s=,2020-11-06 14:21:39.043 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-20,2121450128,930331198976,1 +EJYYtKPXFLMqm66CR0zZqGWgZgk=,2020-10-06 22:17:18.969 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-31,2121450128,930331198976,1 +XMY/jEg8ysxEt7otmvGL+OrvMeI=,2020-10-06 22:17:18.704 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-24,2121450128,930331198976,2 +Yq3UBsiFy5UjLNhxFkcZaLvbqT8=,2020-10-14 14:21:22.003 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-14,2121450128,930331198976,1 +LfeYvMpSk8oOB1lpKYfG1oQ6pfs=,2020-11-06 14:21:39.751 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-02,2121450128,930331198976,1 +U24D3yjWA24uoXOcvoPP17K1sdg=,2020-10-23 14:21:05.249 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-23,2121450128,930331198976,1 +IwV6C9f4gxwL1PBQN52y3fz5hWs=,2020-10-08 14:21:33.606 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-08,2121450128,930331198976,2 +Fkqnnf9KN10gWGM9HnrJqStWx00=,2020-11-06 14:21:38.162 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-12,2121450128,930331198976,3 +bcIo090y4HHe1OjJ/SAOcW1ZZtI=,2020-11-06 20:21:01.239 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-05,2121450128,930331198976,2 +QjIK40It78uW7HQNglvM8nWSeTw=,2020-11-04 14:21:12.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,9.38,+fivetran +braze,,Keyword,2020-10-05,2121450128,930331198976,4 +6mRcJ1UMU8Yo/UWP/ucYVoU7a3k=,2020-10-06 22:17:18.829 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-28,2121450128,930331198976,2 +D/FDdl8QMnhXHlT7x4i9U7oOUEc=,2020-10-06 22:17:18.765 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-25,2121450128,930331198976,5 +mze24+dC9BR4FroYvCNuSVZAEgU=,2020-11-06 14:21:39.437 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-27,2121450128,930331198976,1 +0XE7Gxs1vyg5Yg74LyYtifNxYh8=,2020-11-06 20:21:01.318 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,3.16,+fivetran +braze,,Keyword,2020-11-06,2121450128,930331198976,3 +mK1FQRRpJNcunORjEjFBSp5BGa4=,2020-10-06 22:17:18.688 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-23,2121450128,930331198976,1 +hinrqfo2Z/PydqCqGvK/Ufcp7Lc=,2020-11-06 14:21:38.717 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,1.47,+fivetran +braze,,Keyword,2020-10-15,2121450128,930331198976,1 +kldjG3KPWf2d2dUBXXfaQ2gFTek=,2020-11-06 14:21:39.314 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-23,2121450128,930331198976,1 diff --git a/dbt_packages/google_ads/integration_tests/seeds/google_ads_final_url_performance_data.csv b/dbt_packages/google_ads/integration_tests/seeds/google_ads_final_url_performance_data.csv new file mode 100644 index 0000000..6c05f98 --- /dev/null +++ b/dbt_packages/google_ads/integration_tests/seeds/google_ads_final_url_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,cost,date,effective_final_url,external_customer_id,impressions +t0DPvJZPXc0dEeRXzvW1Ws630Kg=,2020-11-06 14:21:38.048 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,14,64.46,2020-10-08,https://fivetran.com/,2121450128,58 +ejSkj6uwxNeyDj1MTYLOevYKfhM=,2020-11-06 14:21:38.309 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,21,105.14,2020-10-20,https://fivetran.com/,2121450128,61 +ithyLOIIhpXy5UH+fNrXzzdQkWk=,2020-11-06 14:21:38.346 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,13,59.62,2020-10-21,https://fivetran.com/,2121450128,68 +rgAreBQ1/9AGgXLw/euz7Z6dr6U=,2020-11-06 14:21:38.215 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,14,65.67,2020-10-16,https://fivetran.com/,2121450128,48 +SMdF02iwFmyYbBKhcetY736a6qM=,2020-11-06 14:21:38.194 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,17,78.33,2020-10-15,https://fivetran.com/,2121450128,60 +k7SyAJ3iMCPOOuHLq+0sRyVwjNY=,2020-11-01 14:21:41.500 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,17,72.38,2020-10-02,https://fivetran.com/,2121450128,49 +i2JkG9GTlrYDSgZ4J5IgYKIskNs=,2020-11-06 14:21:38.575 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,111.58,2020-10-29,https://fivetran.com/,2121450128,74 +FAVTl0sD4TIyJyCP+prU5GJj3Pw=,2020-11-06 20:21:00.925 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,13,70.08,2020-11-06,https://fivetran.com/,2121450128,49 +5nxDcoA1OdaIqJinxY/8DsecrIY=,2020-11-06 14:21:38.291 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,87.67,2020-10-19,https://fivetran.com/,2121450128,75 +KYPsLyfw2jYzs/QhP9lpOTIppfg=,2020-11-06 20:21:00.954 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,15,85.4,2020-11-05,https://fivetran.com/,2121450128,47 +n37rkdOOY4goe+jUs1h+N6c1g6I=,2020-11-06 14:21:38.559 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,118.6,2020-10-27,https://fivetran.com/,2121450128,76 +wsIKp1H7kdlc7J8errgdME/rYU4=,2020-10-06 22:17:29.115 UTC,p6zp17DVJVjAD3VAr1btVw==,104918891267,Dgdx4cvumsqzPS0LFplOjQ==,enabled,10204071965,Bg4wdiKgpaGR7QNEBl6tow==,paused,13,7.363337,2020-06-06,https://fivetran.com/signup,2121450128,288 +TZqftZZ0ezKu9gRCfS5ubwD1x5o=,2020-10-06 22:17:27.885 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,110,12.539943,2020-05-14,https://fivetran.com/signup,2121450128,19205 +3VZnjszL0jPIzywjmKcSd0SBUpo=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,83,13.263128,2020-05-16,https://fivetran.com/signup,2121450128,12822 +LEoFuxsykXnNIS1qdseugWgqWes=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,147,17.806708,2020-06-05,https://fivetran.com/signup,2121450128,20231 +ZdQa2bk1yfHC74rLV9T+L3EIcM0=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,140,13.137977,2020-05-22,https://get.fivetran.com/demo,2121450128,30956 +TbPhTKNiM/vydc3EX8WYV3qE+bE=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,126,10.169802,2020-05-17,https://fivetran.com/signup,2121450128,17513 +RfIObZXowXEUP5M7J1UY6A3IsT4=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,100,16.643208,2020-05-15,https://fivetran.com/signup,2121450128,18417 +hgPgjbA9EDmc6NTQrZj8tXcZKfY=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,152,13.250064,2020-05-18,https://fivetran.com/signup,2121450128,11488 +ENGmiWQ69CG1mo239/82kpFj/74=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,66,7.849638,2020-05-30,https://fivetran.com/signup,2121450128,5172 +PmBdD3C0Z4I4wadodfVl8RfV5j8=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,210,29.947659,2020-05-24,https://fivetran.com/signup,2121450128,19768 +K/ZoJBB9LkJ8SSUhrl14HhhmnWw=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,132,18.748165,2020-05-25,https://fivetran.com/signup,2121450128,14069 +L/MsqYf1sHoojNOeSwgHlDPutsc=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,108,11.012773,2020-06-03,https://fivetran.com/signup,2121450128,6908 +EiK6BeUczKWlL10zjSb89q3lCd0=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,142,9.671773,2020-05-19,https://fivetran.com/signup,2121450128,6198 ++okCr+2/LLMpYRMBxgo7B0gEMs4=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,180,7.875836,2020-05-21,https://get.fivetran.com/demo,2121450128,32030 +Gs42eEiAEQQLzrg10y/oGcrBazM=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,169,9.881831,2020-05-21,https://fivetran.com/signup,2121450128,32166 +VJAWpLazVJ7SbF9nOx9cClog1kc=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,81,9.359642,2020-06-02,https://fivetran.com/signup,2121450128,5876 +BIHVYPao1Voga6RgGap9gDVbbck=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,124,23.094801,2020-05-28,https://fivetran.com/signup,2121450128,24506 +z5bCjczmoANz46XsYFsCy/vFgeo=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,77,8.64865,2020-06-01,https://fivetran.com/signup,2121450128,5146 +EQnKPZ0t4kdvu9MUsfRQR7ugNWA=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,38,4.344248,2020-06-10,https://fivetran.com/signup,2121450128,1989 +kJ5kT9/EiOsMHqhwNPkfr9JcOeE=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,13,0.884615,2020-05-25,https://get.fivetran.com/demo,2121450128,5018 +M/JdDV2dvc2SeEkOm4LoKg/OSOo=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,160,13.858554,2020-05-22,https://fivetran.com/signup,2121450128,27639 +dh/J6LWOy2zmainTEWBCey6t3oI=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,22,1.374976,2020-05-24,https://get.fivetran.com/demo,2121450128,9800 +eCRJjS0B7MkQtBojFr+ucuuzZCE=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,125,15.057942,2020-06-06,https://fivetran.com/signup,2121450128,10450 +ZAqneAQ0q0RlTeKHHvdaQXu062w=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,127,19.477663,2020-05-31,https://fivetran.com/signup,2121450128,7896 +F2IczjeiisqckTIcgGxRfGmpQeY=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,278,30.229589,2020-06-08,https://fivetran.com/signup,2121450128,14067 +agp+oV5ayhGsb/eAS8L6Yl4I1rM=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,42,3.502521,2020-05-27,https://fivetran.com/signup,2121450128,3060 +b0i/YFpkh1r43dzHo4NaB5+v/ik=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,170,8.900929,2020-05-20,https://fivetran.com/signup,2121450128,3440 +MtionUIOXGZ4SzWEzD4t7x7K4Io=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,141,16.827692,2020-06-09,https://fivetran.com/signup,2121450128,4941 +R9q4+tVutvtfdOqFZnvxTiqBR9M=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,113,15.452109,2020-06-07,https://fivetran.com/signup,2121450128,7776 +yiFWlibRn6+SPblJ+pcLlJnf9pw=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,129,18.835226,2020-05-26,https://fivetran.com/signup,2121450128,15402 +lrp3BgPEBlWpYNXPuyACD0Cp8nU=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,69,9.299847,2020-05-23,https://fivetran.com/signup,2121450128,8270 +3G99pZ/PgL5k01UhxufqMhIVjvM=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,113,20.253699,2020-05-29,https://fivetran.com/signup,2121450128,8071 +bMzsF8dFTVYU9RB87uwTJOeQljk=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,19,4.298416,2020-06-10,https://fivetran.com/signup,2121450128,191 +P63DDyaVvoALWxOMBuY73boL1WU=,2020-10-06 22:17:29.112 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,54,12.645893,2020-06-06,https://fivetran.com/signup,2121450128,513 +K+22OcUc/TYP7Gh2IqfP3nvaItg=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,26,8.986242,2020-06-04,https://fivetran.com/signup,2121450128,645 +ibH3UoETsjIywQz2niF9OWpKa0k=,2020-10-06 22:17:29.112 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,43,9.279726,2020-06-07,https://fivetran.com/signup,2121450128,465 +gbGJiEMtkQSs7sbXSlmZxI0piGM=,2020-10-06 22:17:29.129 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,128,37.36967,2020-06-08,https://fivetran.com/signup,2121450128,1804 +heSOb85T1t9LMOnLegfRQuPEnKg=,2020-10-06 22:17:29.129 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,102,26.172773,2020-06-09,https://fivetran.com/signup,2121450128,1413 +2BEeIV4Dh2rcUONpg+JI9Jr2Plc=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,22,8.694242,2020-06-04,https://get.fivetran.com/demo,2121450128,255 +1+fkSic+5Ag/ZPAm/aGyBbN6SC4=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,36,5.118154,2020-05-28,https://fivetran.com/signup,2121450128,870 +Ff9K+HiXDNlVJgcq4b1Zlol0XrQ=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,46,6.609135,2020-05-24,https://fivetran.com/signup,2121450128,1135 +312vFl34U85rR+7xwgsEkLsignQ=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,48,6.555083,2020-06-07,https://fivetran.com/signup,2121450128,2211 +5pyaKAhy4b0bapsf+CNd7WHsmkM=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,53,8.40214,2020-06-06,https://fivetran.com/signup,2121450128,1871 +JHslbAPb3QqnM/6IsY6dFzoZkOE=,2020-10-06 22:17:30.485 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,14,4.539851,2020-06-17,https://fivetran.com/signup,2121450128,1821 +cJYeZxdRlOa3V5TaXZMfAzWtdvw=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,22,2.194164,2020-05-21,https://fivetran.com/signup,2121450128,579 +14DN50JwsW+2tzzw1GlDqZyhP3A=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,29,5.583538,2020-06-10,https://fivetran.com/signup,2121450128,2003 +Qo30up1d9RdBxTwM7pBZQ7Op3zQ=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,32,6.308484,2020-06-09,https://fivetran.com/signup,2121450128,1679 +Ogkpfw9NAZhiAbXdadsQLjA1cSY=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,45,4.373474,2020-05-26,https://fivetran.com/signup,2121450128,967 +/ukSwWJoxX9fP6U3FGUkA4Zmy8o=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,41,9.272221,2020-06-08,https://fivetran.com/signup,2121450128,2089 +nUDMKZYZITnXAp5660aTLqR1P0U=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,33,7.715897,2020-05-25,https://fivetran.com/signup,2121450128,686 +AaNfsrWtH2X0dVTTTD657xf9y70=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,13,2.335834,2020-05-25,https://get.fivetran.com/demo,2121450128,451 +x9QgybfvMYJHJsA+JzpOzknLt0M=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,29,3.716316,2020-05-22,https://fivetran.com/signup,2121450128,726 +8tXpg/A3zwY9IavbNsJgZYcIKfA=,2020-10-06 22:17:29.195 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,56,9.246693,2020-05-27,https://fivetran.com/signup,2121450128,1045 +Y653lvwyR2BbS2RqsSwFDKa2QH8=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,44,5.49378,2020-06-01,https://fivetran.com/signup,2121450128,881 +jKIaj2uiQPI/PhvsWVCC+U6MlkA=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,13,1.057608,2020-06-05,https://fivetran.com/signup,2121450128,922 +jqKgdE/GTvg22805haAG+CjKgOU=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,27,2.18607,2020-05-21,https://get.fivetran.com/demo,2121450128,631 +BDnqeKAMw78eronzdS5TjoL1Fa8=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,31,6.136347,2020-05-29,https://fivetran.com/signup,2121450128,690 +rudq0t44A0JVUqTroBpB90t2bsE=,2020-10-06 22:17:29.225 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,47,5.570398,2020-06-03,https://fivetran.com/signup,2121450128,627 +zEeViDf4yOQzMwoUnRGPhPb/EiI=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,14,7.863472,2020-05-30,https://fivetran.com/signup,2121450128,283 +7LTrU42E9xrfc0eGVomat6MJBOI=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,21,2.247402,2020-05-22,https://get.fivetran.com/demo,2121450128,744 +6TKsFQgyKjbfFeMKsOisqSnmpwE=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,23,3.460865,2020-05-24,https://get.fivetran.com/demo,2121450128,935 +6qLnEPKndBjAojdeWxyh5BlAXcs=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,36,4.563421,2020-06-02,https://fivetran.com/signup,2121450128,374 +85EMFh++iU3F6kDeIii6TF688VM=,2020-10-06 22:16:53.887 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,9.85,2017-05-05,http://www.fivetran.com,2121450128,85 +efDGE+TVToI3WsWJdegyTzD9LzQ=,2020-10-06 22:17:14.724 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,17,49.56,2019-04-09,https://fivetran.com/demo,2121450128,199 +MknLKodiAmtKSAmLTtjlDZq3HJE=,2020-10-06 22:17:16.512 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,24,130.74,2019-06-10,https://fivetran.com/demo,2121450128,305 +aBf9mEfET+AVzujJus2JlUbsRHk=,2020-10-06 22:16:54.992 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,14,12.47,2017-06-13,https://fivetran.com/demo,2121450128,109 +rDxXCaDc1G07wrpG2/OMT9iCi+0=,2020-10-06 22:17:14.724 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,17,65.99,2019-04-08,https://fivetran.com/demo,2121450128,173 +14mN9iPuB/EIEzdtmovxTFBgmT8=,2020-10-06 22:17:13.650 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,15,64.48,2019-03-06,https://fivetran.com/demo,2121450128,130 +stsXQZpYjfXEcpgAGxWQ23U8XGY=,2020-10-06 22:17:14.740 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,61.38,2019-04-12,https://fivetran.com/demo,2121450128,138 +nJB2f1men7ADaaksyoyl8oWWf8Q=,2020-10-06 22:17:05.969 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,21,66.44,2018-06-07,https://fivetran.com/demo,2121450128,144 +jztW0Bg3++9ZZCZ2iR+eO/CXiRU=,2020-10-06 22:17:02.950 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,36.54,2018-02-15,https://fivetran.com/demo,2121450128,119 +99+nX/vq+5HfmdLSaCjwQDwjOeo=,2020-10-06 22:17:32.793 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,53,585.64,2020-08-24,https://fivetran.com/signup,2121450128,456 +MoQcvQ2+fE+OecQO1ZXDM3lnvuE=,2020-10-06 22:17:17.453 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,60,308.52,2019-07-08,https://get.fivetran.com/demo,2121450128,527 +Xn6k8b4ZOI4BbGkrNtdJIgSImnE=,2020-10-06 22:17:19.687 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,26,277.76,2019-08-28,https://get.fivetran.com/demo,2121450128,181 +MeQVJGD/wirQfbxyQCDGp4ObKvg=,2020-10-06 22:17:27.736 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,29,177.15,2020-04-28,https://get.fivetran.com/demo,2121450128,268 +VrSbUgnYQjdKsWzAa/VADbcGYG0=,2020-10-06 22:17:16.512 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,86.84,2019-05-22,https://get.fivetran.com/demo,2121450128,270 +FExymA9syq+hKbSHTsKU0G1821w=,2020-10-06 22:17:21.331 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,240.56,2019-10-20,https://get.fivetran.com/demo,2121450128,107 +j0xOj437KOehlyp0uNZI9QNLmLs=,2020-10-06 22:17:15.767 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,52.51,2019-05-03,https://get.fivetran.com/demo,2121450128,198 +y0uh0mUG+Hz4migzYC6UAHjXcWY=,2020-10-06 22:17:20.566 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,192.63,2019-10-07,https://get.fivetran.com/demo,2121450128,203 +9m1rZ0zKW+TWGcuqUF05cGP77Wc=,2020-10-06 22:17:09.273 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,15,91.35,2018-09-25,https://get.fivetran.com/demo,2121450128,200 +I0yWi/bzWk/bXyVzXEAZ11xUhRE=,2020-10-06 22:17:11.296 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,25,100.28,2018-12-05,https://get.fivetran.com/demo,2121450128,302 +PSpo33zOhnjcJepSFTsnRqOP7GU=,2020-10-06 22:17:20.566 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,33,400.0,2019-09-23,https://get.fivetran.com/demo,2121450128,420 +U2WA6BMhLEhrozxCWNvDGcaNn0I=,2020-10-06 22:17:22.152 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,53,252.26,2019-12-11,https://get.fivetran.com/demo,2121450128,555 +3EZlye3DDf505zhMROd15pgsAqk=,2020-10-06 22:17:09.273 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,74.32,2018-10-22,https://get.fivetran.com/demo,2121450128,175 +CAK6rDgrSeN7erqDXlRC6DNKsk8=,2020-10-06 22:17:11.297 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,46,176.85,2018-12-04,https://get.fivetran.com/demo,2121450128,479 +XQoO5jW+Nqh3GISHStLN8qxgHWA=,2020-11-05 14:21:47.952 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,65,553.92,2020-10-06,https://fivetran.com/signup?utm_source=google&utm_medium=cpc&utm_campaign=7011G000000QYFHQA4,2121450128,594 +8pSXTj920NcBaggPr0oNUbnPTWU=,2020-10-06 22:16:47.062 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,14.89,2016-10-05,http://www.fivetran.com,2121450128,72 +q+/rPsjAgoVyw5Ahv/TF9WUoEpw=,2020-10-06 22:17:02.950 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,34.69,2018-02-21,https://fivetran.com/demo,2121450128,109 +vO7+dxjy7pFP1xOVnx0iPGsE0Vk=,2020-10-06 22:17:01.203 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,14,27.33,2017-12-12,https://fivetran.com/demo,2121450128,155 diff --git a/dbt_packages/google_ads/models/criteria/google_ads__criteria_ad_adapter.sql b/dbt_packages/google_ads/models/criteria/google_ads__criteria_ad_adapter.sql new file mode 100644 index 0000000..7d70e89 --- /dev/null +++ b/dbt_packages/google_ads/models/criteria/google_ads__criteria_ad_adapter.sql @@ -0,0 +1,33 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with base as ( + + select * + from {{ var('criteria_performance') }} + +), fields as ( + + select + date_day, + account_name, + external_customer_id, + campaign_name, + campaign_id, + ad_group_name, + ad_group_id, + criteria, + criteria_type, + sum(spend) as spend, + sum(clicks) as clicks, + sum(impressions) as impressions + + {% for metric in var('google_ads__criteria_passthrough_metrics') %} + , sum({{ metric }}) as {{ metric }} + {% endfor %} + from base + {{ dbt_utils.group_by(9) }} + +) + +select * +from fields \ No newline at end of file diff --git a/dbt_packages/google_ads/models/google_ads.yml b/dbt_packages/google_ads/models/google_ads.yml new file mode 100644 index 0000000..fd52ef3 --- /dev/null +++ b/dbt_packages/google_ads/models/google_ads.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: google_ads__url_ad_adapter + description: Each record in this table represents the daily performance of URLs at the ad group level. + columns: + - name: date_day + description: "{{ doc('date') }}" + - name: account_name + description: "{{ doc('account_descriptive_name') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: base_url + description: "{{ doc('base_url') }}" + - name: url_host + description: "{{ doc('url_host') }}" + - name: url_path + description: "{{ doc('url_path') }}" + - name: utm_source + description: "{{ doc('utm_source') }}" + - name: utm_medium + description: "{{ doc('utm_medium') }}" + - name: utm_campaign + description: "{{ doc('utm_campaign') }}" + - name: utm_content + description: "{{ doc('utm_content') }}" + - name: utm_term + description: "{{ doc('utm_term') }}" + - name: spend + description: "{{ doc('cost') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: impressions + description: "{{ doc('impressions') }}" + - name: criteria + description: "{{ doc('criteria') }}" + - name: criteria_type + description: "{{ doc('criteria_type') }}" + - name: google_ads__click_performance + description: Each record represents a click, with a unique Google Click ID (gclid). + columns: + - name: date_day + description: "{{ doc('date') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: criteria_id + description: "{{ doc('criteria_id') }}" + - name: gclid + description: "{{ doc('gcl_id') }}" + - name: rn + description: Row number partitioned by gclid and ordered by date_day which is used to dedupe possible double gclids. \ No newline at end of file diff --git a/dbt_packages/google_ads/models/google_ads__click_performance.sql b/dbt_packages/google_ads/models/google_ads__click_performance.sql new file mode 100644 index 0000000..f9906ff --- /dev/null +++ b/dbt_packages/google_ads/models/google_ads__click_performance.sql @@ -0,0 +1,28 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with base as ( + + select * + from {{ var('click_performance') }} + +), fields as ( + + select + date_day, + campaign_id, + ad_group_id, + criteria_id, + gclid, + row_number() over (partition by gclid order by date_day) as rn + from base + +), filtered as ( -- we've heard that sometimes duplicates gclids are an issue. This dedupe ensures no glcids are double counted. + + select * + from fields + where gclid is not null + and rn = 1 + +) + +select * from filtered \ No newline at end of file diff --git a/dbt_packages/google_ads/models/url_adwords/google_ads__url_ad_adapter.sql b/dbt_packages/google_ads/models/url_adwords/google_ads__url_ad_adapter.sql new file mode 100644 index 0000000..d6f9714 --- /dev/null +++ b/dbt_packages/google_ads/models/url_adwords/google_ads__url_ad_adapter.sql @@ -0,0 +1,39 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with base as ( + + select * + from {{ var('final_url_performance') }} + +), fields as ( + + select + date_day, + account_name, + external_customer_id, + campaign_name, + campaign_id, + ad_group_name, + ad_group_id, + base_url, + url_host, + url_path, + utm_source, + utm_medium, + utm_campaign, + utm_content, + utm_term, + sum(spend) as spend, + sum(clicks) as clicks, + sum(impressions) as impressions + + {% for metric in var('google_ads__url_passthrough_metrics') %} + , sum({{ metric }}) as {{ metric }} + {% endfor %} + from base + {{ dbt_utils.group_by(15) }} + +) + +select * +from fields \ No newline at end of file diff --git a/dbt_packages/google_ads/models/url_google_ads/google_ads__url_ad_adapter.sql b/dbt_packages/google_ads/models/url_google_ads/google_ads__url_ad_adapter.sql new file mode 100644 index 0000000..8780798 --- /dev/null +++ b/dbt_packages/google_ads/models/url_google_ads/google_ads__url_ad_adapter.sql @@ -0,0 +1,72 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with stats as ( + + select * + from {{ var('ad_stats') }} + +), accounts as ( + + select * + from {{ var('account_history') }} + where is_most_recent_record = True + +), campaigns as ( + + select * + from {{ var('campaign_history') }} + where is_most_recent_record = True + +), ad_groups as ( + + select * + from {{ var('ad_group_history') }} + where is_most_recent_record = True + +), ads as ( + + select * + from {{ var('ad_history') }} + where is_most_recent_record = True + +), fields as ( + + select + stats.date_day, + accounts.account_name, + accounts.account_id, + campaigns.campaign_name, + campaigns.campaign_id, + ad_groups.ad_group_name, + ad_groups.ad_group_id, + ads.base_url, + ads.url_host, + ads.url_path, + ads.utm_source, + ads.utm_medium, + ads.utm_campaign, + ads.utm_content, + ads.utm_term, + sum(stats.spend) as spend, + sum(stats.clicks) as clicks, + sum(stats.impressions) as impressions + + {% for metric in var('google_ads__ad_stats_passthrough_metrics') %} + , sum(stats.{{ metric }}) as {{ metric }} + {% endfor %} + + from stats + left join ads + on stats.ad_id = ads.ad_id + left join ad_groups + on ads.ad_group_id = ad_groups.ad_group_id + left join campaigns + on ad_groups.campaign_id = campaigns.campaign_id + left join accounts + on campaigns.account_id = accounts.account_id + {{ dbt_utils.group_by(15) }} + +) + +select * +from fields \ No newline at end of file diff --git a/dbt_packages/google_ads/packages.yml b/dbt_packages/google_ads/packages.yml new file mode 100644 index 0000000..e69baba --- /dev/null +++ b/dbt_packages/google_ads/packages.yml @@ -0,0 +1,3 @@ +packages: +- package: fivetran/google_ads_source + version: [">=0.7.0", "<0.8.0"] diff --git a/dbt_packages/google_ads_source/.circleci/config.yml b/dbt_packages/google_ads_source/.circleci/config.yml new file mode 100644 index 0000000..99dbcf2 --- /dev/null +++ b/dbt_packages/google_ads_source/.circleci/config.yml @@ -0,0 +1,92 @@ +version: 2 + +jobs: + build: + docker: + - image: circleci/python:3.7.9-stretch + + steps: + - checkout + + - run: + run: setup_creds + command: | + echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json + - run: + name: "Setup dbt" + command: | + sudo apt install libsasl2-dev + python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip setuptools + pip install -r integration_tests/requirements.txt + mkdir -p ~/.dbt + cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml + - run: + name: "Run Tests - Postgres" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target postgres --full-refresh + dbt run --target postgres --full-refresh + dbt test --target postgres + dbt run --vars '{google_auto_tagging_enabled: true}' --target postgres --full-refresh + dbt run --vars '{api_source: adwords}' --target postgres --full-refresh + dbt test --target postgres + - run: + name: "Run Tests - Spark" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target spark --full-refresh + dbt run --target spark --full-refresh + dbt test --target spark + dbt run --vars '{google_auto_tagging_enabled: true}' --target spark --full-refresh + dbt run --vars '{api_source: adwords}' --target spark --full-refresh + dbt test --target spark + - run: + name: "Run Tests - Redshift" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target redshift --full-refresh + dbt run --target redshift --full-refresh + dbt test --target redshift + dbt run --vars '{google_auto_tagging_enabled: true}' --target redshift --full-refresh + dbt run --vars '{api_source: adwords}' --target redshift --full-refresh + dbt test --target redshift + - run: + name: "Run Tests - Snowflake" + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target snowflake --full-refresh + dbt run --target snowflake --full-refresh + dbt test --target snowflake + dbt run --vars '{google_auto_tagging_enabled: true}' --target snowflake --full-refresh + dbt run --vars '{api_source: adwords}' --target snowflake --full-refresh + dbt test --target snowflake + - run: + name: "Run Tests - BigQuery" + environment: + GCLOUD_SERVICE_KEY_PATH: "/home/circleci/gcloud-service-key.json" + + command: | + . venv/bin/activate + echo `pwd` + cd integration_tests + dbt deps + dbt seed --target bigquery --full-refresh + dbt run --target bigquery --full-refresh + dbt test --target bigquery + dbt run --vars '{google_auto_tagging_enabled: true}' --target bigquery --full-refresh + dbt run --vars '{api_source: adwords}' --target bigquery --full-refresh + dbt test --target bigquery \ No newline at end of file diff --git a/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/bug-report.yml b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..17c2c54 --- /dev/null +++ b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,88 @@ +name: 🐞 Bug +description: Report a bug or an issue you've found within the dbt package +title: "[Bug] " +labels: ["bug", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this bug report. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the issue + description: A concise description of the problem you're experiencing. Also, please provide the steps to reproduce the issue if applicable. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant error log or model output + description: | + If applicable, provide the relevant error log or describe the problematic model output. + render: shell + validations: + required: false + - type: textarea + attributes: + label: Expected behavior + description: A concise description of what you expected to happen. + validations: + required: true + - type: textarea + attributes: + label: dbt Project configurations + description: Please provide the variables and any other project specific configurations from your `dbt_project.yml`. + validations: + required: true + - type: textarea + attributes: + label: Package versions + description: Please provide the contents of your `packages.yml`. + validations: + required: true + - type: dropdown + id: database + attributes: + label: What database are you using dbt with? + multiple: true + options: + - postgres + - redshift + - snowflake + - bigquery + - databricks + - other (mention it in "Additional Context") + validations: + required: true + - type: textarea + attributes: + label: dbt Version + description: Run `dbt --version` in your CLI or dbt cloud environment and copy the contents. Additionally, if you are using Fivetran dbt Transformations, provide the contents of the `dbtVersion` configuration in your `deployment.yml`. + validations: + required: true + - type: textarea + attributes: + label: Additional Context + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: checkboxes + id: pr + attributes: + label: Are you willing to open a PR to help address this issue? + description: Our team will assess this issue and let you know if we will add it to a future sprint. However, if you would like to expedite the solution, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during our [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance + - label: No. + required: false \ No newline at end of file diff --git a/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/config.yml b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..65a074b --- /dev/null +++ b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,13 @@ +contact_links: + - name: Ask a question during our office hours + url: https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours + about: Schedule time during the external office hours block with the Fivetran Analytics Engineering team for support + - name: Fivetran connector question + url: https://support.fivetran.com/hc + about: Have a question about your connector? Check out the Fivetran support portal for more details. + - name: What is dbt + url: https://docs.getdbt.com/docs/introduction + about: Check out the dbt docs for all dbt related information + - name: Hang out in dbt Slack + url: https://www.getdbt.com/community/ + about: Have a question or just want to chat with fellow data friends, join dbt Slack and hangout in the tools-fivetran channel with us! \ No newline at end of file diff --git a/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/feature-request.yml b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..a1d28bb --- /dev/null +++ b/dbt_packages/google_ads_source/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,46 @@ +name: 🎉 Feature +description: Suggest a new feature for the Fivetran dbt package +title: "[Feature] <title>" +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this feature request. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing feature request for this? + description: Please search to see if an issue already exists for the feature you would like. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the Feature + description: A clear and concise description of what you want to happen and why you want the new feature. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: checkboxes + id: contributing + attributes: + label: Are you interested in contributing this feature? + description: Our team will assess this feature and let you know if we will add it to a future sprint. However, if you would like to expedite the feature, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during your [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance. + - label: No. + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the feature you are suggesting! + validations: + required: false diff --git a/dbt_packages/google_ads_source/.github/pull_request_template.md b/dbt_packages/google_ads_source/.github/pull_request_template.md new file mode 100644 index 0000000..f450926 --- /dev/null +++ b/dbt_packages/google_ads_source/.github/pull_request_template.md @@ -0,0 +1,52 @@ +**Are you a current Fivetran customer?** +<!--- Please tell us your name, title and company --> + +**What change(s) does this PR introduce?** +<!--- Describe what changes your PR introduces to the package and how to leverage this new feature. --> + +**Did you update the CHANGELOG?** +<!--- Please update the new package version’s CHANGELOG entry detailing the changes included in this PR. --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes + +**Does this PR introduce a breaking change?** +<!--- Does this PR introduce changes that will cause current package users' jobs to fail or require a `--full-refresh`? --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes (please provide breaking change details below.) +- [ ] No (please provide an explanation as to how the change is non-breaking below.) + +**Did you update the dbt_project.yml files with the version upgrade (please leverage standard semantic versioning)? (In both your main project and integration_tests)** +<!--- The dbt_project.yml and the integration_tests/dbt_project.yml files contain the version number. Be sure to upgrade it accordingly --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes + +**Is this PR in response to a previously created Bug or Feature Request** +<!--- If an Issue was created it is helpful to track the progress by linking it in the PR. --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] Yes, Issue/Feature [link bug/feature number here] +- [ ] No + +**How did you test the PR changes?** +<!--- Proof of testing is required in order for the PR to be approved. --> +<!--- To check a box, remove the space and insert an x in the box (eg. [x] CircleCi). --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] CircleCi <!--- CircleCi testing is only applicable to Fivetran employees. --> +- [ ] Local (please provide additional testing details below) + +**Select which warehouse(s) were used to test the PR** +<!--- To check a warehouse remove the space and insert an x in the box (eg. [x] Bigquery). --> +<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). --> +- [ ] BigQuery +- [ ] Redshift +- [ ] Snowflake +- [ ] Postgres +- [ ] Databricks +- [ ] Other (provide details below) + +**Provide an emoji that best describes your current mood** +<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) --> +:dancer: + +**Feedback** + +We are so excited you decided to contribute to the Fivetran community dbt package! We continue to work to improve the packages and would greatly appreciate your [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next. diff --git a/dbt_packages/google_ads_source/.gitignore b/dbt_packages/google_ads_source/.gitignore new file mode 100644 index 0000000..2710741 --- /dev/null +++ b/dbt_packages/google_ads_source/.gitignore @@ -0,0 +1,6 @@ + +target/ +dbt_modules/ +logs/ + +dbt_packages/ \ No newline at end of file diff --git a/dbt_packages/google_ads_source/CHANGELOG.md b/dbt_packages/google_ads_source/CHANGELOG.md new file mode 100644 index 0000000..5fdcbc0 --- /dev/null +++ b/dbt_packages/google_ads_source/CHANGELOG.md @@ -0,0 +1,30 @@ +# dbt_google_ads_source v0.7.0 +## 🚨 Breaking Changes 🚨 +- The `api_source` variable is now defaulted to `google_ads` as opposed to `adwords`. The Adwords API has since been deprecated by Google and is now no longer the standard API for the Google Ads connector. Please ensure you are using a Google Ads API version of the Fivetran connector before upgrading this package. ([#28](https://github.com/fivetran/dbt_google_ads_source/pull/28)) + - Please note, the `adwords` version of this package will be fully removed from the package in August of 2022. This means, models under `models/adwords_connector` will be removed in favor of `models/google_ads_connector` models. +# dbt_google_ads_source v0.6.0 +## 🚨 Breaking Changes 🚨 +- The `account` source table has been renamed to be `account_history`. This has been reflected in this release. ([#25](https://github.com/fivetran/dbt_google_ads_source/pull/25)) +- The `ad_final_url_history` model has been removed from the connector. The url fields are now references within the `final_urls` field within the `ad_history` table. ([#25](https://github.com/fivetran/dbt_google_ads_source/pull/25)) + - Please be aware that the logic in the `stg_google_ads__ad_history` model for the Google Ads API will only pull through the first url in the `final_urls` list. This column should contain only one url. However, in the even that two are include a test will warn you that the other urls have been removed from the final model. + +# dbt_google_ads_source v0.5.0 +🎉 dbt v1.0.0 Compatibility 🎉 +## 🚨 Breaking Changes 🚨 +- Adjusts the `require-dbt-version` to now be within the range [">=1.0.0", "<2.0.0"]. Additionally, the package has been updated for dbt v1.0.0 compatibility. If you are using a dbt version <1.0.0, you will need to upgrade in order to leverage the latest version of the package. + - For help upgrading your package, I recommend reviewing this GitHub repo's Release Notes on what changes have been implemented since your last upgrade. + - For help upgrading your dbt project to dbt v1.0.0, I recommend reviewing dbt-labs [upgrading to 1.0.0 docs](https://docs.getdbt.com/docs/guides/migration-guide/upgrading-to-1-0-0) for more details on what changes must be made. +- Upgrades the package dependency to refer to the latest `dbt_fivetran_utils`. The latest `dbt_fivetran_utils` package also has a dependency on `dbt_utils` [">=0.8.0", "<0.9.0"]. + - Please note, if you are installing a version of `dbt_utils` in your `packages.yml` that is not in the range above then you will encounter a package dependency error. + + +# dbt_google_ads_source v0.4.1 + +## Bug Fixes +- Renaming of the folder names within the `dbt_project.yml` to match the current spelling of the `/models/` folder names. This allows for the materialization of the `tmp` models to accurately be materialized as views. ([#19](https://github.com/fivetran/dbt_google_ads_source/pull/19)) + +## Contributors +- [NoToWarAlways](https://github.com/NoToWarAlways) ([#19](https://github.com/fivetran/dbt_google_ads_source/pull/19)) + +# dbt_google_ads_source v0.1.0 -> v0.4.0 +Refer to the relevant release notes on the Github repository for specific details for the previous releases. Thank you! diff --git a/dbt_packages/google_ads_source/LICENSE b/dbt_packages/google_ads_source/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/dbt_packages/google_ads_source/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/dbt_packages/google_ads_source/README.md b/dbt_packages/google_ads_source/README.md new file mode 100644 index 0000000..1423b25 --- /dev/null +++ b/dbt_packages/google_ads_source/README.md @@ -0,0 +1,192 @@ +[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +# Google Ads (Source) + +This package models Google Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/google-ads). + +## Models + +This package contains staging models, designed to work simultaneously with our [Google Ads transform package](https://github.com/fivetran/dbt_google_ads) and our [multi-platform Ad Reporting package](https://github.com/fivetran/dbt_ad_reporting). The staging models name columns consistently across all packages: + * Boolean fields are prefixed with `is_` or `has_` + * Timestamps are appended with `_timestamp` + * ID primary keys are prefixed with the name of the table. For example, the campaign table's ID column is renamed `campaign_id`. + +## Installation Instructions +Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions, or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. + +Include in your `packages.yml` + +```yaml +packages: + - package: fivetran/google_ads_source + version: [">=0.7.0", "<0.8.0"] +``` +## Configuration + +This package allows users to leverage either the Adwords API or the Google Ads API. You will be able to determine which API your connector is using by navigating within your Fivetran UI to the `setup` tab -> `edit connection details` link -> and reference the `API configuration` used. You will want to refer to the respective configuration steps below based off the API used by your connector. + +> **Note**: As of April, 2022 all Fivetran Google Ads connectors leverage the Google Ads API rather than Adwords. Additionally, please be aware that the Adwords API version of the package will be sunset in August of 2022. +### Google Ads API Configuration +If your connector is setup using the Google Ads API then you will need to configure your `dbt_project.yml` with the below variable: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + api_source: google_ads ## google_ads by default, but may be changed to 'adwords' if using a previous version of the connector. +``` + +### Adwords API Configuration +If your connector is setup using the Adwords API then you will need to pull the following custom reports through Fivetran: + +* Destination Table Name: `final_url_performance` +* Report Type: `FINAL_URL_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * Cost + * Date + * EffectiveFinalUrl + * ExternalCustomerId + * Impressions + +* Destination Table Name: `criteria_performance` +* Report Type: `CRITERIA_PERFORMANCE_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * Cost + * Criteria + * CriteriaDestinationUrl + * CriteriaType + * Date + * ExternalCustomerId + * Id + * Impressions + +* Destination Table Name: `click_performance` +* Report Type: `CLICK_PERFORMANCE_REPORT` +* Fields: + * AccountDescriptiveName + * AdGroupId + * AdGroupName + * AdGroupStatus + * CampaignId + * CampaignName + * CampaignStatus + * Clicks + * CriteriaId + * Date + * ExternalCustomerId + * GclId + +The package assumes that the corresponding destination tables are named `final_url_performance`, `criteria_performance`, and `click_performance` respectively. If these tables have different names in your destination, enter the correct table names in the `google_ads__final_url_performance`, `google_ads__click_performance`, and `google_ads__criteria_performance` variables so that the package can find them: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + google_ads__final_url_performance: "{{ ref('a_model_you_wrote') }}" + google_ads__click_performance: adwords.click_performance_report +``` + +### Source Schema is Named Differently + +By default, this package will look for your Google Ads data in the `adwords` or `google_ads` schema of your [target database](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile), depending on which API source you are using. If this is not where your Google Ads data is, please add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +config-version: 2 + +vars: + google_ads_schema: your_schema_name + google_ads_database: your_database_name +``` +## Optional Configurations +### Passing Through Additional Metrics +By default, this package will select `clicks`, `impressions`, and `cost` from the source reporting tables to store into the staging models. If you would like to pass through additional metrics to the staging models, add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +vars: + # If you're using the Adwords API source + google_ads__url_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from adwords.final_url_performance + google_ads__criteria_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from adwords.criteria_performance + + # If you're using the Google Ads API source + google_ads__ad_stats_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from google_ads.ad_stats +``` + +### UTM Auto Tagging Feature +This package assumes you are manually adding UTM tags to the `EffectiveFinalUrl` field within the `FINAL_URL_REPORT` table. If you are leveraging the auto-tag feature within Google Ads then you will want to enable the `google_auto_tagging_enabled` variable to correctly populate the UTM fields within the `stg_google_ads__final_url_performance` model. +```yml +vars: + google_ads_source: + google_auto_tagging_enabled: true # False by default +``` + +### Changing the Build Schema +By default this package will build the Google Ads staging models within a schema titled (<target_schema> + `_stg_google_ads`) in your target database. If this is not where you would like your Google Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +models: + google_ads_source: + +schema: my_new_schema_name # leave blank for just the target_schema +``` + +## Database Support + +This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks. + +### Databricks Dispatch Configuration +dbt `v0.20.0` introduced a new project-level dispatch configuration that enables an "override" setting for all dispatched macros. If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively. +```yml +# dbt_project.yml + +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] +``` +## Contributions + +Additional contributions to this package are very welcome! Please create issues +or open PRs against `main`. Check out +[this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) +on the best workflow for contributing to a package. + +## Resources: +- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next +- Have questions, feedback, or need help? Book a time during our office hours [using Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at solutions@fivetran.com +- Find all of Fivetran's pre-built dbt packages in our [dbt hub](https://hub.getdbt.com/fivetran/) +- Learn how to orchestrate your models with [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt) +- Learn more about Fivetran overall [in our docs](https://fivetran.com/docs) +- Check out [Fivetran's blog](https://fivetran.com/blog) +- Learn more about dbt [in the dbt docs](https://docs.getdbt.com/docs/introduction) +- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers +- Join the [chat](http://slack.getdbt.com/) on Slack for live discussions and support +- Find [dbt events](https://events.getdbt.com) near you +- Check out [the dbt blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices diff --git a/dbt_packages/google_ads_source/dbt_project.yml b/dbt_packages/google_ads_source/dbt_project.yml new file mode 100644 index 0000000..076ef74 --- /dev/null +++ b/dbt_packages/google_ads_source/dbt_project.yml @@ -0,0 +1,29 @@ +name: 'google_ads_source' +version: '0.7.0' +config-version: 2 +require-dbt-version: [">=1.0.0", "<2.0.0"] + +vars: + google_ads__final_url_performance: "{{ source('adwords','final_url_performance') }}" + google_ads__click_performance: "{{ source('adwords','click_performance') }}" + google_ads__criteria_performance: "{{ source('adwords','criteria_performance') }}" + google_ads__ad_stats: "{{ source('adwords','ad_stats') }}" + google_ads__ad_history: "{{ source('adwords','ad_history') }}" + google_ads__ad_group_history: "{{ source('adwords','ad_group_history') }}" + google_ads__campaign_history: "{{ source('adwords','campaign_history') }}" + google_ads__account_history: "{{ source('adwords','account_history') }}" + api_source: google_ads + google_ads__url_passthrough_metrics: [] + google_ads__criteria_passthrough_metrics: [] + google_ads__ad_stats_passthrough_metrics: [] + +models: + google_ads_source: + +schema: stg_google_ads + +materialized: table + adwords_connector: + tmp: + +materialized: view + google_ads_connector: + tmp: + +materialized: view diff --git a/dbt_packages/google_ads_source/docs/catalog.json b/dbt_packages/google_ads_source/docs/catalog.json new file mode 100644 index 0000000..985f725 --- /dev/null +++ b/dbt_packages/google_ads_source/docs/catalog.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.1", "generated_at": "2022-02-11T21:44:39.199050Z", "invocation_id": "9c2eb406-371d-4d6d-b2f4-bec742be6e4d", "env": {}}, "nodes": {"model.google_ads_source.stg_google_ads__account_history": {"metadata": {"type": "table", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__account_history", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"account_id": {"type": "INT64", "index": 1, "name": "account_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "currency_code": {"type": "STRING", "index": 4, "name": "currency_code", "comment": null}, "account_name": {"type": "STRING", "index": 5, "name": "account_name", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 6, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 46.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1840.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.google_ads_source.stg_google_ads__account_history"}, "model.google_ads_source.stg_google_ads__ad_history_tmp": {"metadata": {"type": "view", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_history_tmp", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "id": {"type": "INT64", "index": 2, "name": "id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "action_items": {"type": "STRING", "index": 5, "name": "action_items", "comment": null}, "ad_strength": {"type": "STRING", "index": 6, "name": "ad_strength", "comment": null}, "added_by_google_ads": {"type": "BOOL", "index": 7, "name": "added_by_google_ads", "comment": null}, "device_preference": {"type": "STRING", "index": 8, "name": "device_preference", "comment": null}, "display_url": {"type": "STRING", "index": 9, "name": "display_url", "comment": null}, "final_app_urls": {"type": "STRING", "index": 10, "name": "final_app_urls", "comment": null}, "final_mobile_urls": {"type": "STRING", "index": 11, "name": "final_mobile_urls", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 12, "name": "final_url_suffix", "comment": null}, "final_urls": {"type": "STRING", "index": 13, "name": "final_urls", "comment": null}, "name": {"type": "STRING", "index": 14, "name": "name", "comment": null}, "policy_summary_approval_status": {"type": "STRING", "index": 15, "name": "policy_summary_approval_status", "comment": null}, "policy_summary_review_status": {"type": "STRING", "index": 16, "name": "policy_summary_review_status", "comment": null}, "status": {"type": "STRING", "index": 17, "name": "status", "comment": null}, "system_managed_resource_source": {"type": "STRING", "index": 18, "name": "system_managed_resource_source", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 19, "name": "tracking_url_template", "comment": null}, "type": {"type": "STRING", "index": 20, "name": "type", "comment": null}, "url_collections": {"type": "STRING", "index": 21, "name": "url_collections", "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.google_ads_source.stg_google_ads__ad_history_tmp"}, "model.google_ads_source.stg_google_ads__ad_stats_tmp": {"metadata": {"type": "view", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_stats_tmp", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"_fivetran_id": {"type": "STRING", "index": 1, "name": "_fivetran_id", "comment": null}, "customer_id": {"type": "INT64", "index": 2, "name": "customer_id", "comment": null}, "date": {"type": "DATE", "index": 3, "name": "date", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "active_view_impressions": {"type": "INT64", "index": 5, "name": "active_view_impressions", "comment": null}, "active_view_measurability": {"type": "FLOAT64", "index": 6, "name": "active_view_measurability", "comment": null}, "active_view_measurable_cost_micros": {"type": "INT64", "index": 7, "name": "active_view_measurable_cost_micros", "comment": null}, "active_view_measurable_impressions": {"type": "INT64", "index": 8, "name": "active_view_measurable_impressions", "comment": null}, "active_view_viewability": {"type": "FLOAT64", "index": 9, "name": "active_view_viewability", "comment": null}, "ad_group": {"type": "STRING", "index": 10, "name": "ad_group", "comment": null}, "ad_group_base_ad_group": {"type": "STRING", "index": 11, "name": "ad_group_base_ad_group", "comment": null}, "ad_id": {"type": "INT64", "index": 12, "name": "ad_id", "comment": null}, "ad_network_type": {"type": "STRING", "index": 13, "name": "ad_network_type", "comment": null}, "campaign_base_campaign": {"type": "STRING", "index": 14, "name": "campaign_base_campaign", "comment": null}, "campaign_id": {"type": "INT64", "index": 15, "name": "campaign_id", "comment": null}, "clicks": {"type": "INT64", "index": 16, "name": "clicks", "comment": null}, "conversions": {"type": "FLOAT64", "index": 17, "name": "conversions", "comment": null}, "conversions_value": {"type": "FLOAT64", "index": 18, "name": "conversions_value", "comment": null}, "cost_micros": {"type": "INT64", "index": 19, "name": "cost_micros", "comment": null}, "device": {"type": "STRING", "index": 20, "name": "device", "comment": null}, "impressions": {"type": "INT64", "index": 21, "name": "impressions", "comment": null}, "interaction_event_types": {"type": "STRING", "index": 22, "name": "interaction_event_types", "comment": null}, "interactions": {"type": "INT64", "index": 23, "name": "interactions", "comment": null}, "keyword_ad_group_criterion": {"type": "STRING", "index": 24, "name": "keyword_ad_group_criterion", "comment": null}, "view_through_conversions": {"type": "INT64", "index": 25, "name": "view_through_conversions", "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.google_ads_source.stg_google_ads__ad_stats_tmp"}, "model.google_ads_source.stg_google_ads__ad_group_history_tmp": {"metadata": {"type": "view", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_group_history_tmp", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_rotation_mode": {"type": "STRING", "index": 4, "name": "ad_rotation_mode", "comment": null}, "base_ad_group_id": {"type": "INT64", "index": 5, "name": "base_ad_group_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 6, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "display_custom_bid_dimension": {"type": "STRING", "index": 8, "name": "display_custom_bid_dimension", "comment": null}, "explorer_auto_optimizer_setting_opt_in": {"type": "BOOL", "index": 9, "name": "explorer_auto_optimizer_setting_opt_in", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 10, "name": "final_url_suffix", "comment": null}, "name": {"type": "STRING", "index": 11, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 12, "name": "status", "comment": null}, "target_restrictions": {"type": "STRING", "index": 13, "name": "target_restrictions", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 14, "name": "tracking_url_template", "comment": null}, "type": {"type": "STRING", "index": 15, "name": "type", "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.google_ads_source.stg_google_ads__ad_group_history_tmp"}, "model.google_ads_source.stg_google_ads__campaign_history_tmp": {"metadata": {"type": "view", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__campaign_history_tmp", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_serving_optimization_status": {"type": "STRING", "index": 4, "name": "ad_serving_optimization_status", "comment": null}, "advertising_channel_subtype": {"type": "STRING", "index": 5, "name": "advertising_channel_subtype", "comment": null}, "advertising_channel_type": {"type": "STRING", "index": 6, "name": "advertising_channel_type", "comment": null}, "base_campaign_id": {"type": "INT64", "index": 7, "name": "base_campaign_id", "comment": null}, "customer_id": {"type": "INT64", "index": 8, "name": "customer_id", "comment": null}, "end_date": {"type": "STRING", "index": 9, "name": "end_date", "comment": null}, "experiment_type": {"type": "STRING", "index": 10, "name": "experiment_type", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 11, "name": "final_url_suffix", "comment": null}, "frequency_caps": {"type": "STRING", "index": 12, "name": "frequency_caps", "comment": null}, "name": {"type": "STRING", "index": 13, "name": "name", "comment": null}, "optimization_score": {"type": "FLOAT64", "index": 14, "name": "optimization_score", "comment": null}, "payment_mode": {"type": "STRING", "index": 15, "name": "payment_mode", "comment": null}, "serving_status": {"type": "STRING", "index": 16, "name": "serving_status", "comment": null}, "start_date": {"type": "STRING", "index": 17, "name": "start_date", "comment": null}, "status": {"type": "STRING", "index": 18, "name": "status", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 19, "name": "tracking_url_template", "comment": null}, "vanity_pharma_display_url_mode": {"type": "STRING", "index": 20, "name": "vanity_pharma_display_url_mode", "comment": null}, "vanity_pharma_text": {"type": "STRING", "index": 21, "name": "vanity_pharma_text", "comment": null}, "video_brand_safety_suitability": {"type": "STRING", "index": 22, "name": "video_brand_safety_suitability", "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.google_ads_source.stg_google_ads__campaign_history_tmp"}, "model.google_ads_source.stg_google_ads__ad_group_history": {"metadata": {"type": "table", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_group_history", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "updated_timestamp": {"type": "TIMESTAMP", "index": 2, "name": "updated_timestamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_group_type": {"type": "STRING", "index": 4, "name": "ad_group_type", "comment": null}, "campaign_id": {"type": "INT64", "index": 5, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 6, "name": "campaign_name", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "ad_group_status": {"type": "STRING", "index": 8, "name": "ad_group_status", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 9, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5182.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 546958.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.google_ads_source.stg_google_ads__ad_group_history"}, "model.google_ads_source.stg_google_ads__campaign_history": {"metadata": {"type": "table", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__campaign_history", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_timestamp": {"type": "TIMESTAMP", "index": 2, "name": "updated_timestamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "campaign_name": {"type": "STRING", "index": 4, "name": "campaign_name", "comment": null}, "account_id": {"type": "INT64", "index": 5, "name": "account_id", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 6, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1554.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 94057.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.google_ads_source.stg_google_ads__campaign_history"}, "model.google_ads_source.stg_google_ads__ad_stats": {"metadata": {"type": "table", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_stats", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"account_id": {"type": "INT64", "index": 1, "name": "account_id", "comment": null}, "date_day": {"type": "DATE", "index": 2, "name": "date_day", "comment": null}, "ad_group_id": {"type": "STRING", "index": 3, "name": "ad_group_id", "comment": null}, "ad_id": {"type": "INT64", "index": 4, "name": "ad_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 5, "name": "campaign_id", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 7, "name": "spend", "comment": null}, "impressions": {"type": "INT64", "index": 8, "name": "impressions", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 323921.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 32391798.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.google_ads_source.stg_google_ads__ad_stats"}, "model.google_ads_source.stg_google_ads__ad_history": {"metadata": {"type": "table", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__ad_history", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "ad_id": {"type": "INT64", "index": 2, "name": "ad_id", "comment": null}, "updated_timestamp": {"type": "TIMESTAMP", "index": 3, "name": "updated_timestamp", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "ad_type": {"type": "STRING", "index": 5, "name": "ad_type", "comment": null}, "ad_status": {"type": "STRING", "index": 6, "name": "ad_status", "comment": null}, "org_final_urls": {"type": "STRING", "index": 7, "name": "org_final_urls", "comment": null}, "final_url": {"type": "STRING", "index": 8, "name": "final_url", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 9, "name": "is_most_recent_record", "comment": null}, "base_url": {"type": "STRING", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "STRING", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "STRING", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "STRING", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "STRING", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "STRING", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "STRING", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "STRING", "index": 17, "name": "utm_term", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 105019.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 23053253.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.google_ads_source.stg_google_ads__ad_history"}, "model.google_ads_source.stg_google_ads__account_history_tmp": {"metadata": {"type": "view", "schema": "dbt_joe_google_ads", "name": "stg_google_ads__account_history_tmp", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "auto_tagging_enabled": {"type": "BOOL", "index": 4, "name": "auto_tagging_enabled", "comment": null}, "currency_code": {"type": "STRING", "index": 5, "name": "currency_code", "comment": null}, "descriptive_name": {"type": "STRING", "index": 6, "name": "descriptive_name", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 7, "name": "final_url_suffix", "comment": null}, "hidden": {"type": "BOOL", "index": 8, "name": "hidden", "comment": null}, "manager": {"type": "BOOL", "index": 9, "name": "manager", "comment": null}, "manager_customer_id": {"type": "INT64", "index": 10, "name": "manager_customer_id", "comment": null}, "optimization_score": {"type": "FLOAT64", "index": 11, "name": "optimization_score", "comment": null}, "pay_per_conversion_eligibility_failure_reasons": {"type": "STRING", "index": 12, "name": "pay_per_conversion_eligibility_failure_reasons", "comment": null}, "test_account": {"type": "BOOL", "index": 13, "name": "test_account", "comment": null}, "time_zone": {"type": "STRING", "index": 14, "name": "time_zone", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 15, "name": "tracking_url_template", "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.google_ads_source.stg_google_ads__account_history_tmp"}}, "sources": {"source.google_ads_source.adwords.account_history": {"metadata": {"type": "table", "schema": "google_ads_4", "name": "account_history", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "auto_tagging_enabled": {"type": "BOOL", "index": 4, "name": "auto_tagging_enabled", "comment": null}, "currency_code": {"type": "STRING", "index": 5, "name": "currency_code", "comment": null}, "descriptive_name": {"type": "STRING", "index": 6, "name": "descriptive_name", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 7, "name": "final_url_suffix", "comment": null}, "hidden": {"type": "BOOL", "index": 8, "name": "hidden", "comment": null}, "manager": {"type": "BOOL", "index": 9, "name": "manager", "comment": null}, "manager_customer_id": {"type": "INT64", "index": 10, "name": "manager_customer_id", "comment": null}, "optimization_score": {"type": "FLOAT64", "index": 11, "name": "optimization_score", "comment": null}, "pay_per_conversion_eligibility_failure_reasons": {"type": "STRING", "index": 12, "name": "pay_per_conversion_eligibility_failure_reasons", "comment": null}, "test_account": {"type": "BOOL", "index": 13, "name": "test_account", "comment": null}, "time_zone": {"type": "STRING", "index": 14, "name": "time_zone", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 15, "name": "tracking_url_template", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 46.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 8924.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.google_ads_source.adwords.account_history"}, "source.google_ads_source.adwords.campaign_history": {"metadata": {"type": "table", "schema": "google_ads_4", "name": "campaign_history", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_serving_optimization_status": {"type": "STRING", "index": 4, "name": "ad_serving_optimization_status", "comment": null}, "advertising_channel_subtype": {"type": "STRING", "index": 5, "name": "advertising_channel_subtype", "comment": null}, "advertising_channel_type": {"type": "STRING", "index": 6, "name": "advertising_channel_type", "comment": null}, "base_campaign_id": {"type": "INT64", "index": 7, "name": "base_campaign_id", "comment": null}, "customer_id": {"type": "INT64", "index": 8, "name": "customer_id", "comment": null}, "end_date": {"type": "STRING", "index": 9, "name": "end_date", "comment": null}, "experiment_type": {"type": "STRING", "index": 10, "name": "experiment_type", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 11, "name": "final_url_suffix", "comment": null}, "frequency_caps": {"type": "STRING", "index": 12, "name": "frequency_caps", "comment": null}, "name": {"type": "STRING", "index": 13, "name": "name", "comment": null}, "optimization_score": {"type": "FLOAT64", "index": 14, "name": "optimization_score", "comment": null}, "payment_mode": {"type": "STRING", "index": 15, "name": "payment_mode", "comment": null}, "serving_status": {"type": "STRING", "index": 16, "name": "serving_status", "comment": null}, "start_date": {"type": "STRING", "index": 17, "name": "start_date", "comment": null}, "status": {"type": "STRING", "index": 18, "name": "status", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 19, "name": "tracking_url_template", "comment": null}, "vanity_pharma_display_url_mode": {"type": "STRING", "index": 20, "name": "vanity_pharma_display_url_mode", "comment": null}, "vanity_pharma_text": {"type": "STRING", "index": 21, "name": "vanity_pharma_text", "comment": null}, "video_brand_safety_suitability": {"type": "STRING", "index": 22, "name": "video_brand_safety_suitability", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1554.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 298571.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.google_ads_source.adwords.campaign_history"}, "source.google_ads_source.adwords.ad_stats": {"metadata": {"type": "table", "schema": "google_ads_4", "name": "ad_stats", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"_fivetran_id": {"type": "STRING", "index": 1, "name": "_fivetran_id", "comment": null}, "customer_id": {"type": "INT64", "index": 2, "name": "customer_id", "comment": null}, "date": {"type": "DATE", "index": 3, "name": "date", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "active_view_impressions": {"type": "INT64", "index": 5, "name": "active_view_impressions", "comment": null}, "active_view_measurability": {"type": "FLOAT64", "index": 6, "name": "active_view_measurability", "comment": null}, "active_view_measurable_cost_micros": {"type": "INT64", "index": 7, "name": "active_view_measurable_cost_micros", "comment": null}, "active_view_measurable_impressions": {"type": "INT64", "index": 8, "name": "active_view_measurable_impressions", "comment": null}, "active_view_viewability": {"type": "FLOAT64", "index": 9, "name": "active_view_viewability", "comment": null}, "ad_group": {"type": "STRING", "index": 10, "name": "ad_group", "comment": null}, "ad_group_base_ad_group": {"type": "STRING", "index": 11, "name": "ad_group_base_ad_group", "comment": null}, "ad_id": {"type": "INT64", "index": 12, "name": "ad_id", "comment": null}, "ad_network_type": {"type": "STRING", "index": 13, "name": "ad_network_type", "comment": null}, "campaign_base_campaign": {"type": "STRING", "index": 14, "name": "campaign_base_campaign", "comment": null}, "campaign_id": {"type": "INT64", "index": 15, "name": "campaign_id", "comment": null}, "clicks": {"type": "INT64", "index": 16, "name": "clicks", "comment": null}, "conversions": {"type": "FLOAT64", "index": 17, "name": "conversions", "comment": null}, "conversions_value": {"type": "FLOAT64", "index": 18, "name": "conversions_value", "comment": null}, "cost_micros": {"type": "INT64", "index": 19, "name": "cost_micros", "comment": null}, "device": {"type": "STRING", "index": 20, "name": "device", "comment": null}, "impressions": {"type": "INT64", "index": 21, "name": "impressions", "comment": null}, "interaction_event_types": {"type": "STRING", "index": 22, "name": "interaction_event_types", "comment": null}, "interactions": {"type": "INT64", "index": 23, "name": "interactions", "comment": null}, "keyword_ad_group_criterion": {"type": "STRING", "index": 24, "name": "keyword_ad_group_criterion", "comment": null}, "view_through_conversions": {"type": "INT64", "index": 25, "name": "view_through_conversions", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 323921.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 123911957.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.google_ads_source.adwords.ad_stats"}, "source.google_ads_source.adwords.ad_group_history": {"metadata": {"type": "table", "schema": "google_ads_4", "name": "ad_group_history", "database": "bigquery-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_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_rotation_mode": {"type": "STRING", "index": 4, "name": "ad_rotation_mode", "comment": null}, "base_ad_group_id": {"type": "INT64", "index": 5, "name": "base_ad_group_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 6, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "display_custom_bid_dimension": {"type": "STRING", "index": 8, "name": "display_custom_bid_dimension", "comment": null}, "explorer_auto_optimizer_setting_opt_in": {"type": "BOOL", "index": 9, "name": "explorer_auto_optimizer_setting_opt_in", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 10, "name": "final_url_suffix", "comment": null}, "name": {"type": "STRING", "index": 11, "name": "name", "comment": null}, "status": {"type": "STRING", "index": 12, "name": "status", "comment": null}, "target_restrictions": {"type": "STRING", "index": 13, "name": "target_restrictions", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 14, "name": "tracking_url_template", "comment": null}, "type": {"type": "STRING", "index": 15, "name": "type", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5182.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2508234.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.google_ads_source.adwords.ad_group_history"}, "source.google_ads_source.adwords.ad_history": {"metadata": {"type": "table", "schema": "google_ads_4", "name": "ad_history", "database": "bigquery-db", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "id": {"type": "INT64", "index": 2, "name": "id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "action_items": {"type": "STRING", "index": 5, "name": "action_items", "comment": null}, "ad_strength": {"type": "STRING", "index": 6, "name": "ad_strength", "comment": null}, "added_by_google_ads": {"type": "BOOL", "index": 7, "name": "added_by_google_ads", "comment": null}, "device_preference": {"type": "STRING", "index": 8, "name": "device_preference", "comment": null}, "display_url": {"type": "STRING", "index": 9, "name": "display_url", "comment": null}, "final_app_urls": {"type": "STRING", "index": 10, "name": "final_app_urls", "comment": null}, "final_mobile_urls": {"type": "STRING", "index": 11, "name": "final_mobile_urls", "comment": null}, "final_url_suffix": {"type": "STRING", "index": 12, "name": "final_url_suffix", "comment": null}, "final_urls": {"type": "STRING", "index": 13, "name": "final_urls", "comment": null}, "name": {"type": "STRING", "index": 14, "name": "name", "comment": null}, "policy_summary_approval_status": {"type": "STRING", "index": 15, "name": "policy_summary_approval_status", "comment": null}, "policy_summary_review_status": {"type": "STRING", "index": 16, "name": "policy_summary_review_status", "comment": null}, "status": {"type": "STRING", "index": 17, "name": "status", "comment": null}, "system_managed_resource_source": {"type": "STRING", "index": 18, "name": "system_managed_resource_source", "comment": null}, "tracking_url_template": {"type": "STRING", "index": 19, "name": "tracking_url_template", "comment": null}, "type": {"type": "STRING", "index": 20, "name": "type", "comment": null}, "url_collections": {"type": "STRING", "index": 21, "name": "url_collections", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 105019.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 21278560.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.google_ads_source.adwords.ad_history"}}, "errors": null} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/docs/index.html b/dbt_packages/google_ads_source/docs/index.html new file mode 100644 index 0000000..0c4d0ec --- /dev/null +++ b/dbt_packages/google_ads_source/docs/index.html @@ -0,0 +1,102 @@ +<!DOCTYPE html> +<html dir="ltr" lang="en-US" ng-app='dbt' class='no-flash video supports no-touchevents formvalidation webgl no-cssgridlegacy cssgrid cssfilters objectfit object-fit click landscape videoautoplay loaded'> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, initial-scale=1" /> + + <title>dbt Docs + + + + + + + + + + + + + + + + + +
icons
+
+ + diff --git a/dbt_packages/google_ads_source/docs/manifest.json b/dbt_packages/google_ads_source/docs/manifest.json new file mode 100644 index 0000000..fdcaeb4 --- /dev/null +++ b/dbt_packages/google_ads_source/docs/manifest.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.1", "generated_at": "2022-02-11T21:44:33.974540Z", "invocation_id": "9c2eb406-371d-4d6d-b2f4-bec742be6e4d", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "57178664-37b2-4047-9572-68ec8b488cd7", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "gclid", "model": "{{ get_where_subquery(ref('stg_google_ads__click_performance')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": []}, "config": {"enabled": false, "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": "bigquery-db", "schema": "dbt_joe_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "not_null_stg_google_ads__click_performance_gclid"], "unique_id": "test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "not_null_stg_google_ads__click_performance_gclid.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "not_null_stg_google_ads__click_performance_gclid", "alias": "not_null_stg_google_ads__click_performance_gclid", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__click_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644613440.202071, "column_name": "gclid", "file_key_name": "models.stg_google_ads__click_performance"}, "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}{{ config(alias=\"unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54\") }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "final_url_performance_id", "model": "{{ get_where_subquery(ref('stg_google_ads__final_url_performance')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": []}, "config": {"enabled": false, "alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54", "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": "bigquery-db", "schema": "dbt_joe_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "unique_stg_google_ads__final_url_performance_final_url_performance_id"], "unique_id": "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "unique_stg_google_ads__final_url_performance_final_url_performance_id", "alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__final_url_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "unique_stg_google_ads__final_u_3521f620458941ffffe40e69979b6e54"}, "created_at": 1644613440.2044852, "column_name": "final_url_performance_id", "file_key_name": "models.stg_google_ads__final_url_performance"}, "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}{{ config(alias=\"not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc\") }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "final_url_performance_id", "model": "{{ get_where_subquery(ref('stg_google_ads__final_url_performance')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": []}, "config": {"enabled": false, "alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc", "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": "bigquery-db", "schema": "dbt_joe_dbt_test__audit", "fqn": ["google_ads_source", "adwords_connector", "not_null_stg_google_ads__final_url_performance_final_url_performance_id"], "unique_id": "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc.sql", "original_file_path": "models/adwords_connector/stg_google_ads.yml", "name": "not_null_stg_google_ads__final_url_performance_final_url_performance_id", "alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_google_ads__final_url_performance"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "not_null_stg_google_ads__final_f0dd01c6521cfd7ffe367e7170a9d8cc"}, "created_at": 1644613440.207093, "column_name": "final_url_performance_id", "file_key_name": "models.stg_google_ads__final_url_performance"}, "model.google_ads_source.stg_google_ads__ad_stats": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_stats_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_google_ads__ad_stats_tmp')),\n staging_columns=get_ad_stats_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n customer_id as account_id, \n date as date_day, \n ad_group as ad_group_id, \n ad_id, \n campaign_id, \n clicks, \n cost_micros / 1000000.0 as spend, \n impressions\n \n {% for metric in var('google_ads__ad_stats_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_stats_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__ad_stats_tmp", "model.google_ads_source.stg_google_ads__ad_stats_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_stats"], "unique_id": "model.google_ads_source.stg_google_ads__ad_stats", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_stats.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_stats.sql", "name": "stg_google_ads__ad_stats", "alias": "stg_google_ads__ad_stats", "checksum": {"name": "sha256", "checksum": "8a6c0e4a03004d0e315ff747eda962f58cbe6d2eb264c434e51ddf079093eb54"}, "tags": [], "refs": [["stg_google_ads__ad_stats_tmp"], ["stg_google_ads__ad_stats_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/stg_google_ads__ad_stats.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1644613965.639625, "compiled_sql": "\n\nwith base as (\n\n select * \n from `bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_stats_tmp`\n\n),\n\nfields as (\n\n select\n \n \n \n _fivetran_id\n \n as \n \n _fivetran_id\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active_view_impressions\n \n as \n \n active_view_impressions\n \n, \n \n \n active_view_measurability\n \n as \n \n active_view_measurability\n \n, \n \n \n active_view_measurable_cost_micros\n \n as \n \n active_view_measurable_cost_micros\n \n, \n \n \n active_view_measurable_impressions\n \n as \n \n active_view_measurable_impressions\n \n, \n \n \n active_view_viewability\n \n as \n \n active_view_viewability\n \n, \n \n \n ad_group\n \n as \n \n ad_group\n \n, \n \n \n ad_group_base_ad_group\n \n as \n \n ad_group_base_ad_group\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_network_type\n \n as \n \n ad_network_type\n \n, \n \n \n campaign_base_campaign\n \n as \n \n campaign_base_campaign\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n conversions\n \n as \n \n conversions\n \n, \n \n \n conversions_value\n \n as \n \n conversions_value\n \n, \n \n \n cost_micros\n \n as \n \n cost_micros\n \n, \n \n \n customer_id\n \n as \n \n customer_id\n \n, \n \n \n date\n \n as \n \n date\n \n, \n \n \n device\n \n as \n \n device\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n interaction_event_types\n \n as \n \n interaction_event_types\n \n, \n \n \n interactions\n \n as \n \n interactions\n \n, \n \n \n keyword_ad_group_criterion\n \n as \n \n keyword_ad_group_criterion\n \n, \n \n \n view_through_conversions\n \n as \n \n view_through_conversions\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n customer_id as account_id, \n date as date_day, \n ad_group as ad_group_id, \n ad_id, \n campaign_id, \n clicks, \n cost_micros / 1000000.0 as spend, \n impressions\n \n \n from fields\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_stats`"}, "model.google_ads_source.stg_google_ads__ad_stats_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_stats') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.google_ads_source.adwords.ad_stats"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_stats_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_stats_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql", "name": "stg_google_ads__ad_stats_tmp", "alias": "stg_google_ads__ad_stats_tmp", "checksum": {"name": "sha256", "checksum": "5bbb33a86167f2b5eec66dcef0da5a3157a971a0af09044a64764de3e0267906"}, "tags": [], "refs": [], "sources": [["adwords", "ad_stats"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": true}, "created_at": 1644613965.7024572, "compiled_sql": "\n\nselect * from `bigquery-db`.`google_ads_4`.`ad_stats`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_stats_tmp`"}, "model.google_ads_source.stg_google_ads__ad_history_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.google_ads_source.adwords.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql", "name": "stg_google_ads__ad_history_tmp", "alias": "stg_google_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "9133f01179a6c9c6ccebf38c91c01b926a62ff417bdc642e590feba064bb2fcf"}, "tags": [], "refs": [], "sources": [["adwords", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": true}, "created_at": 1644613965.776611, "compiled_sql": "\n\nselect * from `bigquery-db`.`google_ads_4`.`ad_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_history_tmp`"}, "model.google_ads_source.stg_google_ads__ad_group_history": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_group_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ad_group_id,\n updated_at as updated_timestamp,\n _fivetran_synced, \n type as ad_group_type, \n campaign_id, \n campaign_name, \n name as ad_group_name, \n status as ad_group_status\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__ad_group_history_tmp", "model.google_ads_source.stg_google_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_group_history"], "unique_id": "model.google_ads_source.stg_google_ads__ad_group_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_group_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_group_history.sql", "name": "stg_google_ads__ad_group_history", "alias": "stg_google_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "ce996ca707c9b4e15a8aff038c34b232aa8a72ad9af28d3490441668925d0dd2"}, "tags": [], "refs": [["stg_google_ads__ad_group_history_tmp"], ["stg_google_ads__ad_group_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/stg_google_ads__ad_group_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1644613965.783031, "compiled_sql": "\n\nwith base as (\n\n select * \n from `bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_group_history_tmp`\n\n),\n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_rotation_mode\n \n as \n \n ad_rotation_mode\n \n, \n \n \n base_ad_group_id\n \n as \n \n base_ad_group_id\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n display_custom_bid_dimension\n \n as \n \n display_custom_bid_dimension\n \n, \n \n \n explorer_auto_optimizer_setting_opt_in\n \n as \n \n explorer_auto_optimizer_setting_opt_in\n \n, \n \n \n final_url_suffix\n \n as \n \n final_url_suffix\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 status\n \n as \n \n status\n \n, \n \n \n target_restrictions\n \n as \n \n target_restrictions\n \n, \n \n \n tracking_url_template\n \n as \n \n tracking_url_template\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 \n from base\n),\n\nfinal as (\n \n select \n id as ad_group_id,\n updated_at as updated_timestamp,\n _fivetran_synced, \n type as ad_group_type, \n campaign_id, \n campaign_name, \n name as ad_group_name, \n status as ad_group_status\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_group_history`"}, "model.google_ads_source.stg_google_ads__ad_group_history_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.google_ads_source.adwords.ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__ad_group_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__ad_group_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql", "name": "stg_google_ads__ad_group_history_tmp", "alias": "stg_google_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "f589c8924b0bfbeb75128808090adfc09fbced5b2da9e6db4d9d6f3608dca284"}, "tags": [], "refs": [], "sources": [["adwords", "ad_group_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": true}, "created_at": 1644613965.80197, "compiled_sql": "\n\nselect * from `bigquery-db`.`google_ads_4`.`ad_group_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_group_history_tmp`"}, "model.google_ads_source.stg_google_ads__campaign_history": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__campaign_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as campaign_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n name as campaign_name,\n customer_id as account_id\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__campaign_history_tmp", "model.google_ads_source.stg_google_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__campaign_history"], "unique_id": "model.google_ads_source.stg_google_ads__campaign_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__campaign_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__campaign_history.sql", "name": "stg_google_ads__campaign_history", "alias": "stg_google_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "5d7d9f749113729b95686d5f4a10be5a03bcaceb49dcc1d8010ea4de9812bb49"}, "tags": [], "refs": [["stg_google_ads__campaign_history_tmp"], ["stg_google_ads__campaign_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/stg_google_ads__campaign_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1644613965.809071, "compiled_sql": "\n\nwith base as (\n\n select * \n from `bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__campaign_history_tmp`\n\n),\n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_serving_optimization_status\n \n as \n \n ad_serving_optimization_status\n \n, \n \n \n advertising_channel_subtype\n \n as \n \n advertising_channel_subtype\n \n, \n \n \n advertising_channel_type\n \n as \n \n advertising_channel_type\n \n, \n \n \n base_campaign_id\n \n as \n \n base_campaign_id\n \n, \n \n \n customer_id\n \n as \n \n customer_id\n \n, \n \n \n end_date\n \n as \n \n end_date\n \n, \n \n \n experiment_type\n \n as \n \n experiment_type\n \n, \n \n \n final_url_suffix\n \n as \n \n final_url_suffix\n \n, \n \n \n frequency_caps\n \n as \n \n frequency_caps\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 optimization_score\n \n as \n \n optimization_score\n \n, \n \n \n payment_mode\n \n as \n \n payment_mode\n \n, \n \n \n serving_status\n \n as \n \n serving_status\n \n, \n \n \n start_date\n \n as \n \n start_date\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n tracking_url_template\n \n as \n \n tracking_url_template\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n vanity_pharma_display_url_mode\n \n as \n \n vanity_pharma_display_url_mode\n \n, \n \n \n vanity_pharma_text\n \n as \n \n vanity_pharma_text\n \n, \n \n \n video_brand_safety_suitability\n \n as \n \n video_brand_safety_suitability\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as campaign_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n name as campaign_name,\n customer_id as account_id\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__campaign_history`"}, "model.google_ads_source.stg_google_ads__campaign_history_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.google_ads_source.adwords.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__campaign_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__campaign_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql", "name": "stg_google_ads__campaign_history_tmp", "alias": "stg_google_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "31b88fc1c807181e3fe97c57a0e67fe0455b547fb88acfc1da34fe26773f85ce"}, "tags": [], "refs": [], "sources": [["adwords", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": true}, "created_at": 1644613965.834188, "compiled_sql": "\n\nselect * from `bigquery-db`.`google_ads_4`.`campaign_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__campaign_history_tmp`"}, "model.google_ads_source.stg_google_ads__account_history": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__account_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__account_history_tmp')),\n staging_columns=get_account_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as account_id,\n updated_at,\n _fivetran_synced,\n currency_code, \n descriptive_name as account_name\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by account_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_account_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.google_ads_source.stg_google_ads__account_history_tmp", "model.google_ads_source.stg_google_ads__account_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__account_history"], "unique_id": "model.google_ads_source.stg_google_ads__account_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__account_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__account_history.sql", "name": "stg_google_ads__account_history", "alias": "stg_google_ads__account_history", "checksum": {"name": "sha256", "checksum": "aac9a6170b8904d594a4dfba42cf066227bd310a9519fc7fb571962f9a99ceae"}, "tags": [], "refs": [["stg_google_ads__account_history_tmp"], ["stg_google_ads__account_history_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/stg_google_ads__account_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1644613965.840408, "compiled_sql": "\n\nwith base as (\n\n select * \n from `bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__account_history_tmp`\n\n),\n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n auto_tagging_enabled\n \n as \n \n auto_tagging_enabled\n \n, \n \n \n currency_code\n \n as \n \n currency_code\n \n, \n \n \n descriptive_name\n \n as \n \n descriptive_name\n \n, \n \n \n final_url_suffix\n \n as \n \n final_url_suffix\n \n, \n \n \n hidden\n \n as \n \n hidden\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n manager\n \n as \n \n manager\n \n, \n \n \n manager_customer_id\n \n as \n \n manager_customer_id\n \n, \n \n \n optimization_score\n \n as \n \n optimization_score\n \n, \n \n \n pay_per_conversion_eligibility_failure_reasons\n \n as \n \n pay_per_conversion_eligibility_failure_reasons\n \n, \n \n \n test_account\n \n as \n \n test_account\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n, \n \n \n tracking_url_template\n \n as \n \n tracking_url_template\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 account_id,\n updated_at,\n _fivetran_synced,\n currency_code, \n descriptive_name as account_name\n from fields\n),\n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by account_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__account_history`"}, "model.google_ads_source.stg_google_ads__account_history_tmp": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nselect * from {{ var('google_ads__account_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.google_ads_source.adwords.account_history"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "tmp", "stg_google_ads__account_history_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__account_history_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql", "original_file_path": "models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql", "name": "stg_google_ads__account_history_tmp", "alias": "stg_google_ads__account_history_tmp", "checksum": {"name": "sha256", "checksum": "6023f8a1ab327d732f70c9d716599e00a9f535db622a3a58a04c333586d767d5"}, "tags": [], "refs": [], "sources": [["adwords", "account_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": true}, "created_at": 1644613965.858968, "compiled_sql": "\n\nselect * from `bigquery-db`.`google_ads_4`.`account_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__account_history_tmp`"}, "test.google_ads_source.dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___.353402b689": {"raw_sql": "{{ dbt_expectations.test_expect_column_values_to_not_match_regex_list(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",alias=\"dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff\") }}", "test_metadata": {"name": "expect_column_values_to_not_match_regex_list", "kwargs": {"regex_list": ",", "match_on": "any", "column_name": "final_urls", "model": "{{ get_where_subquery(source('adwords', 'ad_history')) }}"}, "namespace": "dbt_expectations"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list", "macro.dbt.get_where_subquery"], "nodes": ["source.google_ads_source.adwords.ad_history"]}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "warn", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "bigquery-db", "schema": "dbt_joe_dbt_test__audit", "fqn": ["google_ads_source", "dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___"], "unique_id": "test.google_ads_source.dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___.353402b689", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff.sql", "original_file_path": "models/src_google_ads.yml", "name": "dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___", "alias": "dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [], "sources": [["adwords", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/google_ads_source/models/src_google_ads.yml/dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff.sql", "build_path": null, "deferred": false, "unrendered_config": {"severity": "warn", "alias": "dbt_expectations_source_expect_6f17afc23311db890abc938ebd186aff"}, "created_at": 1644613965.946055, "compiled_sql": "\n\n\n\n\n with grouped_expression as (\n select\n \n \n \n \n\n\n\n \nregexp_instr(final_urls, ',', 1, 1)\n\n\n = 0\n as expression\n\n\n from `bigquery-db`.`google_ads_4`.`ad_history`\n \n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression = true)\n\n)\n\nselect *\nfrom validation_errors\n\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "final_urls", "file_key_name": "sources.adwords"}, "model.google_ads_source.stg_google_ads__ad_history": {"raw_sql": "{{ config(enabled=var('api_source') == 'google_ads') }}\n\nwith base as (\n\n select * \n from {{ ref('stg_google_ads__ad_history_tmp') }}\n\n),\n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ad_group_id, \n id as ad_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n type as ad_type,\n status as ad_status,\n replace(replace(final_urls, '[', ''),']','') as final_urls\n from fields\n),\n\nmost_recent as (\n\n select \n ad_group_id,\n ad_id,\n updated_timestamp,\n _fivetran_synced,\n ad_type,\n ad_status,\n\n --Extract the first url within the list of urls provided within the final_urls field\n {{ dbt_utils.split_part(string_text='final_urls', delimiter_text=\"','\", part_number=1) }} as final_url,\n\n row_number() over (partition by ad_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n),\n\nurl_fields as (\n select \n *,\n {{ dbt_utils.split_part('final_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('final_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term\n from most_recent\n)\n\nselect * \nfrom url_fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": ["model.google_ads_source.stg_google_ads__ad_history_tmp", "model.google_ads_source.stg_google_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "google_ads_connector", "stg_google_ads__ad_history"], "unique_id": "model.google_ads_source.stg_google_ads__ad_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "google_ads_connector/stg_google_ads__ad_history.sql", "original_file_path": "models/google_ads_connector/stg_google_ads__ad_history.sql", "name": "stg_google_ads__ad_history", "alias": "stg_google_ads__ad_history", "checksum": {"name": "sha256", "checksum": "549a8167dc79c41680fb30d991e29eee3e69d1f49fc5521f908067579b5fd541"}, "tags": [], "refs": [["stg_google_ads__ad_history_tmp"], ["stg_google_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents a version of an ad in Google Ads.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "The ID of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_timestamp": {"name": "updated_timestamp", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_type": {"name": "ad_type", "description": "The type of the ad in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_status": {"name": "ad_status", "description": "Status of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Boolean representing whether the record is the most recent version of the object.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_url": {"name": "final_url", "description": "The first url in the list of the urls within the final_urls source field.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `effective_final_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/google_ads_connector/stg_google_ads.yml", "compiled_path": "target/compiled/google_ads_source/models/google_ads_connector/stg_google_ads__ad_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": true}, "created_at": 1644615874.28685, "compiled_sql": "\n\nwith base as (\n\n select * \n from `bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_history_tmp`\n\n),\n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n action_items\n \n as \n \n action_items\n \n, \n \n \n ad_group_id\n \n as \n \n ad_group_id\n \n, \n \n \n ad_strength\n \n as \n \n ad_strength\n \n, \n \n \n added_by_google_ads\n \n as \n \n added_by_google_ads\n \n, \n \n \n device_preference\n \n as \n \n device_preference\n \n, \n \n \n display_url\n \n as \n \n display_url\n \n, \n \n \n final_app_urls\n \n as \n \n final_app_urls\n \n, \n \n \n final_mobile_urls\n \n as \n \n final_mobile_urls\n \n, \n \n \n final_url_suffix\n \n as \n \n final_url_suffix\n \n, \n \n \n final_urls\n \n as \n \n final_urls\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 policy_summary_approval_status\n \n as \n \n policy_summary_approval_status\n \n, \n \n \n policy_summary_review_status\n \n as \n \n policy_summary_review_status\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n system_managed_resource_source\n \n as \n \n system_managed_resource_source\n \n, \n \n \n tracking_url_template\n \n as \n \n tracking_url_template\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_collections\n \n as \n \n url_collections\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ad_group_id, \n id as ad_id, \n updated_at as updated_timestamp, \n _fivetran_synced, \n type as ad_type,\n status as ad_status,\n replace(replace(final_urls, '[', ''),']','') as final_urls\n from fields\n),\n\nmost_recent as (\n\n select \n ad_group_id,\n ad_id,\n updated_timestamp,\n _fivetran_synced,\n ad_type,\n ad_status,\n\n --Extract the first url within the list of urls provided within the final_urls field\n \n\n split(\n final_urls,\n ','\n )[safe_offset(0)]\n\n as final_url,\n\n row_number() over (partition by ad_id order by updated_timestamp desc) = 1 as is_most_recent_record\n from final\n\n),\n\nurl_fields as (\n select \n *,\n \n\n split(\n final_url,\n '?'\n )[safe_offset(0)]\n\n as base_url,\n \n safe_cast(\n\n split(\n \n\n split(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n final_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n )[safe_offset(0)]\n\n,\n '?'\n )[safe_offset(0)]\n\n as \n string\n)\n as url_host,\n '/' || \n safe_cast(\n\n split(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ) = 0 \n then ''\n else \n substr(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n -1 * (\n \n length(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n final_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ))\n )\n end,\n '?'\n )[safe_offset(0)]\n\n as \n string\n)\n as url_path,\n nullif(\n\n split(\n \n\n split(\n final_url,\n 'utm_source='\n )[safe_offset(1)]\n\n,\n '&'\n )[safe_offset(0)]\n\n,'') as utm_source,\n nullif(\n\n split(\n \n\n split(\n final_url,\n 'utm_medium='\n )[safe_offset(1)]\n\n,\n '&'\n )[safe_offset(0)]\n\n,'') as utm_medium,\n nullif(\n\n split(\n \n\n split(\n final_url,\n 'utm_campaign='\n )[safe_offset(1)]\n\n,\n '&'\n )[safe_offset(0)]\n\n,'') as utm_campaign,\n nullif(\n\n split(\n \n\n split(\n final_url,\n 'utm_content='\n )[safe_offset(1)]\n\n,\n '&'\n )[safe_offset(0)]\n\n,'') as utm_content,\n nullif(\n\n split(\n \n\n split(\n final_url,\n 'utm_term='\n )[safe_offset(1)]\n\n,\n '&'\n )[safe_offset(0)]\n\n,'') as utm_term\n from most_recent\n)\n\nselect * \nfrom url_fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`bigquery-db`.`dbt_joe_google_ads`.`stg_google_ads__ad_history`"}}, "sources": {"source.google_ads_source.adwords.ad_stats": {"fqn": ["google_ads_source", "adwords", "ad_stats"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.ad_stats", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_stats", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_stats", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents the daily performance of an ad in Google Ads.", "columns": {"customer_id": {"name": "customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group": {"name": "ad_group", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "The ID of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_micros": {"name": "cost_micros", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`ad_stats`", "created_at": 1644613965.9309068}, "source.google_ads_source.adwords.ad_history": {"fqn": ["google_ads_source", "adwords", "ad_history"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.ad_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of an ad in Google Ads.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "id": {"name": "id", "description": "The ID of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the ad in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the Ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_urls": {"name": "final_urls", "description": "A list of urls that are used for the ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`ad_history`", "created_at": 1644613965.9688709}, "source.google_ads_source.adwords.ad_group_history": {"fqn": ["google_ads_source", "adwords", "ad_group_history"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.ad_group_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "ad_group_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "ad_group_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of an ad group in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of the ad group in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`ad_group_history`", "created_at": 1644613965.969054}, "source.google_ads_source.adwords.campaign_history": {"fqn": ["google_ads_source", "adwords", "campaign_history"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.campaign_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "campaign_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a campaign in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "customer_id": {"name": "customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`campaign_history`", "created_at": 1644613965.969214}, "source.google_ads_source.adwords.account_history": {"fqn": ["google_ads_source", "adwords", "account_history"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.account_history", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "account_history", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "account_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a historical version of an account in Google Ads.", "columns": {"id": {"name": "id", "description": "The ID of the Account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency_code": {"name": "currency_code", "description": "The currency of the spend reported.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "descriptive_name": {"name": "descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Timestamp of when the record was last updated in Google Ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`account_history`", "created_at": 1644613965.9693692}, "source.google_ads_source.adwords.final_url_performance": {"fqn": ["google_ads_source", "adwords", "final_url_performance"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.final_url_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "final_url_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "final_url_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents the performance of a final url at the ad group level.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost": {"name": "cost", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "effective_final_url": {"name": "effective_final_url", "description": "Effective final URL of the impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`final_url_performance`", "created_at": 1644613965.969541}, "source.google_ads_source.adwords.click_performance": {"fqn": ["google_ads_source", "adwords", "click_performance"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.click_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "click_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "click_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "The Click Performance report includes stats aggregated at each click level.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_id": {"name": "criteria_id", "description": "The Criterion ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gcl_id": {"name": "gcl_id", "description": "The Google Click ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`click_performance`", "created_at": 1644613965.9697092}, "source.google_ads_source.adwords.criteria_performance": {"fqn": ["google_ads_source", "adwords", "criteria_performance"], "database": "bigquery-db", "schema": "google_ads_4", "unique_id": "source.google_ads_source.adwords.criteria_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "models/src_google_ads.yml", "original_file_path": "models/src_google_ads.yml", "name": "criteria_performance", "source_name": "adwords", "source_description": "", "loader": "Fivetran", "identifier": "criteria_performance", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "The Criteria Performance report includes statistics aggregated at the ad group criteria level, one row per ad group and criteria combination.", "columns": {"_fivetran_id": {"name": "_fivetran_id", "description": "Unique ID used by Fivetran to sync and dedupe data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when a record was last synced.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "account_descriptive_name": {"name": "account_descriptive_name", "description": "The descriptive name of the Customer account.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "The ID of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "The name of the AdGroup.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_status": {"name": "ad_group_status", "description": "Status of the ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The ID of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "The name of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_status": {"name": "campaign_status", "description": "Status of the Campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost": {"name": "cost", "description": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria": {"name": "criteria", "description": "Descriptive string for the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_destination_url": {"name": "criteria_destination_url", "description": "Destination URL of the criterion that triggered ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "criteria_type": {"name": "criteria_type", "description": "The type of the Criterion.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "date": {"name": "date", "description": "The date being reported on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_customer_id": {"name": "external_customer_id", "description": "The Customer ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "id": {"name": "id", "description": "ID of the main object of this row.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "Count of how often your ad has appeared on a search results page or website on the Google Network.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`bigquery-db`.`google_ads_4`.`criteria_performance`", "created_at": 1644613965.969883}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.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": [], "created_at": 1644613437.77504}, "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": [], "created_at": 1644613437.7756789}, "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": [], "created_at": 1644613437.776385}, "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": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613437.782996}, "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": [], "created_at": 1644613437.793001}, "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", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613437.7941859}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_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_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": 1644613437.795146}, "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 {%- 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": 1644613437.7958}, "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": ["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": 1644613437.797454}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.798102}, "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_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": 1644613437.798898}, "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": [], "created_at": 1644613437.7992268}, "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": [], "created_at": 1644613437.799553}, "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": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613437.800043}, "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": [], "created_at": 1644613437.8004181}, "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": [], "created_at": 1644613437.800788}, "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": [], "created_at": 1644613437.800979}, "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": [], "created_at": 1644613437.8014321}, "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": [], "created_at": 1644613437.8018079}, "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": [], "created_at": 1644613437.80227}, "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": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613437.803037}, "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": [], "created_at": 1644613437.803446}, "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": [], "created_at": 1644613437.803849}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.8048792}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.806412}, "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 {#-- 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": 1644613437.8087192}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.809149}, "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": [], "created_at": 1644613437.809979}, "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": [], "created_at": 1644613437.810396}, "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": [], "created_at": 1644613437.811978}, "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": [], "created_at": 1644613437.81322}, "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() %}\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": 1644613437.8147898}, "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\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": 1644613437.819034}, "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 {% 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": 1644613437.8222542}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.825748}, "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": [], "created_at": 1644613437.826903}, "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(\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": 1644613437.830166}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.832483}, "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 {% 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": 1644613437.8396642}, "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": [], "created_at": 1644613437.840893}, "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": [], "created_at": 1644613437.841291}, "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": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613437.841631}, "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/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": 1644613437.8441339}, "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/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": 1644613437.8446379}, "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/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": 1644613437.8450098}, "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/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": 1644613437.845382}, "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/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": 1644613437.8457549}, "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/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": 1644613437.846666}, "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/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": 1644613437.847699}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.848563}, "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/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": 1644613437.8496041}, "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/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": 1644613437.850286}, "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/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": 1644613437.8578072}, "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/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": 1644613437.858242}, "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/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": 1644613437.8588202}, "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/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": 1644613437.8592918}, "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/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": 1644613437.859574}, "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/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": 1644613437.861908}, "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/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": 1644613437.862331}, "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/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": 1644613437.8627741}, "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/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": 1644613437.865252}, "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/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": 1644613437.870246}, "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/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": 1644613437.875625}, "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/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": 1644613437.876357}, "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/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": 1644613437.8767848}, "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/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": 1644613437.8770292}, "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/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": 1644613437.877621}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.88014}, "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/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": 1644613437.880681}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.8814368}, "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/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": 1644613437.8827038}, "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/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": 1644613437.896234}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_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/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": 1644613437.9014258}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_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/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": 1644613437.90257}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.9033642}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.904309}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.9052742}, "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/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": 1644613437.907329}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_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/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": 1644613437.908735}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.910312}, "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/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": 1644613437.915701}, "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/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": 1644613437.9186502}, "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/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": 1644613437.919241}, "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/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": 1644613437.920322}, "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/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": 1644613437.920989}, "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/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": 1644613437.923305}, "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/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": 1644613437.925226}, "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/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": 1644613437.9367712}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.9447832}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.9478998}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.950954}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.9527931}, "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/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": 1644613437.960619}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.961675}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.962144}, "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/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": 1644613437.9626722}, "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/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": 1644613437.9637172}, "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/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": 1644613437.971168}, "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/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": 1644613437.972047}, "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/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": 1644613437.972657}, "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/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": 1644613437.9762712}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.977228}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.977644}, "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/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": 1644613437.978107}, "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/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": 1644613437.978828}, "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/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": 1644613437.985975}, "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/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": 1644613437.992367}, "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/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": 1644613437.9949691}, "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/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": 1644613437.99557}, "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/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": 1644613437.996813}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.997182}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.997483}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.997909}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613437.998207}, "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/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": 1644613437.9994218}, "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/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": 1644613437.9999008}, "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/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": 1644613438.003047}, "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/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": 1644613438.0040698}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.004651}, "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/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": 1644613438.006361}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.00721}, "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/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": 1644613438.0084732}, "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/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": 1644613438.0095181}, "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/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": 1644613438.010165}, "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/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": 1644613438.011075}, "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/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": 1644613438.011654}, "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/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": 1644613438.012388}, "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/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": 1644613438.013964}, "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/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": 1644613438.016435}, "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/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": 1644613438.017858}, "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/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": 1644613438.0185852}, "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": [], "created_at": 1644613438.022254}, "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": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.02532}, "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": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.027197}, "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": [], "created_at": 1644613438.027776}, "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/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": 1644613438.028702}, "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/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": 1644613438.029166}, "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/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": 1644613438.029574}, "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/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": 1644613438.030099}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.031171}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.0315158}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.0319118}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.0330791}, "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/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": 1644613438.0358772}, "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/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": 1644613438.03666}, "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/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": 1644613438.037132}, "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/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": 1644613438.037676}, "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/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": 1644613438.038375}, "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/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": 1644613438.038985}, "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/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": 1644613438.039659}, "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/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": 1644613438.0409238}, "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/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": 1644613438.041947}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.043328}, "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/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": 1644613438.043932}, "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/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": 1644613438.0444238}, "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/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": 1644613438.0456}, "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/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": 1644613438.046129}, "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/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": 1644613438.046782}, "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/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": 1644613438.048275}, "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/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": 1644613438.0496929}, "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/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": 1644613438.0501251}, "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/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": 1644613438.0506449}, "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/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": 1644613438.051073}, "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/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": 1644613438.0517602}, "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/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": 1644613438.0529861}, "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/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": 1644613438.055702}, "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/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": 1644613438.056391}, "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/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": 1644613438.056892}, "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/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": 1644613438.057287}, "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/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": 1644613438.057759}, "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/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": 1644613438.058403}, "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/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": 1644613438.059123}, "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/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": 1644613438.060179}, "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/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": 1644613438.0606568}, "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/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": 1644613438.061067}, "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/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": 1644613438.064115}, "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/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": 1644613438.0646489}, "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/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": 1644613438.065435}, "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/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": 1644613438.0659032}, "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/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": 1644613438.066846}, "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/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": 1644613438.0674272}, "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/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": 1644613438.068952}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.0698261}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": 1644613438.0722198}, "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": "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": 1644613438.0742779}, "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": "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": 1644613438.0749362}, "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": "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": 1644613438.075895}, "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": "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": 1644613438.076864}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.078696}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.0789099}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.079099}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.080031}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.0804539}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.081185}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.081502}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.082916}, "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/GoogleAds/development/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": 1644613438.083251}, "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/GoogleAds/development/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": 1644613438.083439}, "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/GoogleAds/development/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": 1644613438.083622}, "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/GoogleAds/development/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": 1644613438.083808}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.084247}, "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/GoogleAds/development/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": 1644613438.084435}, "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/GoogleAds/development/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": 1644613438.084618}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.085016}, "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/GoogleAds/development/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": 1644613438.0852082}, "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/GoogleAds/development/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": 1644613438.0853949}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.085891}, "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/GoogleAds/development/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": 1644613438.086097}, "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/GoogleAds/development/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": 1644613438.086282}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.086886}, "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/GoogleAds/development/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": 1644613438.0870771}, "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/GoogleAds/development/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": 1644613438.087324}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.087915}, "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/GoogleAds/development/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": 1644613438.0882602}, "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/GoogleAds/development/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": 1644613438.0885901}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.090386}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.091299}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.091617}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.091956}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.093238}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.093941}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.094356}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.094761}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.095253}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.095985}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.096359}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.096542}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.097717}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.098061}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.0984561}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.0988522}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.103495}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.104044}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.10446}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1101198}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.110646}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.111677}, "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/GoogleAds/development/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": 1644613438.1120949}, "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/GoogleAds/development/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": 1644613438.1124249}, "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/GoogleAds/development/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": 1644613438.1129751}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1137989}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.114354}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.114744}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.115579}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.115947}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.116267}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1174982}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.117768}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.118028}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.118965}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1193159}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1196601}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.120398}, "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/GoogleAds/development/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": 1644613438.120663}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.12188}, "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/GoogleAds/development/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": 1644613438.1223412}, "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/GoogleAds/development/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": 1644613438.12271}, "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/GoogleAds/development/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": 1644613438.1229298}, "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/GoogleAds/development/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": 1644613438.123466}, "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/GoogleAds/development/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": 1644613438.1237628}, "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/GoogleAds/development/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": 1644613438.124147}, "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/GoogleAds/development/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": 1644613438.124448}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.124802}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.127697}, "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/GoogleAds/development/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": 1644613438.129017}, "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/GoogleAds/development/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": 1644613438.1302478}, "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/GoogleAds/development/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": 1644613438.130817}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1322722}, "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/GoogleAds/development/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": 1644613438.1330502}, "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/GoogleAds/development/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": 1644613438.133472}, "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/GoogleAds/development/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": 1644613438.134613}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1351218}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1363358}, "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/GoogleAds/development/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": 1644613438.13682}, "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/GoogleAds/development/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": 1644613438.1373289}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1382358}, "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/GoogleAds/development/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": 1644613438.1385741}, "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/GoogleAds/development/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": 1644613438.1389089}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.14105}, "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/GoogleAds/development/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": 1644613438.150298}, "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/GoogleAds/development/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": 1644613438.151724}, "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/GoogleAds/development/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": 1644613438.152691}, "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/GoogleAds/development/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": 1644613438.153971}, "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/GoogleAds/development/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": 1644613438.1677508}, "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/GoogleAds/development/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": 1644613438.168851}, "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/GoogleAds/development/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": 1644613438.1700559}, "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/GoogleAds/development/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": 1644613438.171173}, "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/GoogleAds/development/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": 1644613438.1737149}, "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/GoogleAds/development/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": 1644613438.17467}, "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/GoogleAds/development/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": 1644613438.175489}, "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/GoogleAds/development/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": 1644613438.17627}, "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/GoogleAds/development/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": 1644613438.176693}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.177552}, "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/GoogleAds/development/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": 1644613438.1780522}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1788118}, "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/GoogleAds/development/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": 1644613438.179254}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.180753}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.182301}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.182854}, "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/GoogleAds/development/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": 1644613438.1838431}, "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/GoogleAds/development/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": 1644613438.1845849}, "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/GoogleAds/development/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": 1644613438.186035}, "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/GoogleAds/development/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": 1644613438.187005}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.188061}, "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/GoogleAds/development/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": 1644613438.189031}, "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/GoogleAds/development/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": 1644613438.18993}, "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/GoogleAds/development/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": 1644613438.190378}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.191793}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.193186}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.19446}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.1954198}, "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/GoogleAds/development/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": 1644613438.1965299}, "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/GoogleAds/development/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": 1644613438.197024}, "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/GoogleAds/development/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": 1644613438.1980019}, "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/GoogleAds/development/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": 1644613438.198624}, "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/GoogleAds/development/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": 1644613438.200188}, "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/GoogleAds/development/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": 1644613438.2024992}, "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/GoogleAds/development/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": 1644613438.2037508}, "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/GoogleAds/development/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": 1644613438.204608}, "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/GoogleAds/development/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": 1644613438.205888}, "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/GoogleAds/development/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": 1644613438.207423}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.208645}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.20997}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.211416}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.212981}, "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/GoogleAds/development/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": 1644613438.214277}, "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/GoogleAds/development/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": 1644613438.2147021}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.216279}, "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/GoogleAds/development/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": 1644613438.218483}, "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/GoogleAds/development/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": 1644613438.22481}, "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/GoogleAds/development/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": 1644613438.228765}, "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/GoogleAds/development/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": 1644613438.230696}, "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/GoogleAds/development/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": 1644613438.2323682}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.233104}, "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/GoogleAds/development/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": 1644613438.234058}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.235254}, "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/GoogleAds/development/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": 1644613438.236133}, "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/GoogleAds/development/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": 1644613438.237631}, "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/GoogleAds/development/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": 1644613438.2407942}, "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/GoogleAds/development/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": 1644613438.242481}, "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/GoogleAds/development/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": 1644613438.243554}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.244041}, "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/GoogleAds/development/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": 1644613438.24542}, "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/GoogleAds/development/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": 1644613438.2472022}, "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/GoogleAds/development/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": 1644613438.250029}, "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/GoogleAds/development/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": 1644613438.251266}, "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/GoogleAds/development/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": 1644613438.251992}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.253629}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.256542}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.2599092}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.265217}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.268099}, "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/GoogleAds/development/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": 1644613438.2753868}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.276268}, "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/GoogleAds/development/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": 1644613438.276895}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.2782452}, "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/GoogleAds/development/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": 1644613438.2806542}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.2816691}, "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/GoogleAds/development/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": 1644613438.282384}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.283283}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.2841349}, "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/GoogleAds/development/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": 1644613438.287053}, "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/GoogleAds/development/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": 1644613438.287776}, "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/GoogleAds/development/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": 1644613438.290325}, "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/GoogleAds/development/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": 1644613438.291711}, "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/GoogleAds/development/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": 1644613438.293798}, "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/GoogleAds/development/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": 1644613438.297485}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.299969}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.3025138}, "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/GoogleAds/development/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": 1644613438.303514}, "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/GoogleAds/development/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": 1644613438.305015}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.307104}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.307816}, "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/GoogleAds/development/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": 1644613438.309269}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.311433}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.320659}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3226519}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.325147}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.327272}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.329549}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.331894}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.332541}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.332969}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.340234}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.354557}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.355154}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3553438}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.35691}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3603818}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.361225}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3619242}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.362617}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.363492}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.364017}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.364668}, "macro.dbt_date.get_date_dimension": {"unique_id": "macro.dbt_date.get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "get_date_dimension", "macro_sql": "{% macro get_date_dimension(start_date, end_date) %}\n {{ adapter.dispatch('get_date_dimension', 'dbt_date') (start_date, end_date) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__get_date_dimension"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.378016}, "macro.dbt_date.default__get_date_dimension": {"unique_id": "macro.dbt_date.default__get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "default__get_date_dimension", "macro_sql": "{% macro default__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n select\n cast(d.date_day as date) as date_day,\n cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n from\n \tbase_dates d\n\n)\nselect\n d.date_day,\n {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n d.prior_year_date_day as prior_year_date_day,\n d.prior_year_over_year_date_day,\n {{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,\n {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,\n {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year,\n {{ dbt_date.month_name('d.date_day', short=false) }} as month_name,\n {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short,\n\n cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year,\n cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'quarter') }} as date) as quarter_end_date,\n\n cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number,\n cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt_utils.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt_utils.type_int", "macro.dbt_date.month_name", "macro.dbt_utils.date_trunc", "macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3845298}, "macro.dbt_date.postgres__get_date_dimension": {"unique_id": "macro.dbt_date.postgres__get_date_dimension", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_date_dimension.sql", "original_file_path": "macros/get_date_dimension.sql", "name": "postgres__get_date_dimension", "macro_sql": "{% macro postgres__get_date_dimension(start_date, end_date) %}\nwith base_dates as (\n {{ dbt_date.get_base_dates(start_date, end_date) }}\n),\ndates_with_prior_year_dates as (\n\n select\n cast(d.date_day as date) as date_day,\n cast({{ dbt_utils.dateadd('year', -1 , 'd.date_day') }} as date) as prior_year_date_day,\n cast({{ dbt_utils.dateadd('day', -364 , 'd.date_day') }} as date) as prior_year_over_year_date_day\n from\n \tbase_dates d\n\n)\nselect\n d.date_day,\n {{ dbt_date.yesterday('d.date_day') }} as prior_date_day,\n {{ dbt_date.tomorrow('d.date_day') }} as next_date_day,\n d.prior_year_date_day as prior_year_date_day,\n d.prior_year_over_year_date_day,\n {{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,\n\n {{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,\n {{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,\n {{ dbt_date.day_of_month('d.date_day') }} as day_of_month,\n {{ dbt_date.day_of_year('d.date_day') }} as day_of_year,\n\n {{ dbt_date.week_start('d.date_day') }} as week_start_date,\n {{ dbt_date.week_end('d.date_day') }} as week_end_date,\n {{ dbt_date.week_start('d.prior_year_over_year_date_day') }} as prior_year_week_start_date,\n {{ dbt_date.week_end('d.prior_year_over_year_date_day') }} as prior_year_week_end_date,\n {{ dbt_date.week_of_year('d.date_day') }} as week_of_year,\n\n {{ dbt_date.iso_week_start('d.date_day') }} as iso_week_start_date,\n {{ dbt_date.iso_week_end('d.date_day') }} as iso_week_end_date,\n {{ dbt_date.iso_week_start('d.prior_year_over_year_date_day') }} as prior_year_iso_week_start_date,\n {{ dbt_date.iso_week_end('d.prior_year_over_year_date_day') }} as prior_year_iso_week_end_date,\n {{ dbt_date.iso_week_of_year('d.date_day') }} as iso_week_of_year,\n\n {{ dbt_date.week_of_year('d.prior_year_over_year_date_day') }} as prior_year_week_of_year,\n {{ dbt_date.iso_week_of_year('d.prior_year_over_year_date_day') }} as prior_year_iso_week_of_year,\n\n cast({{ dbt_date.date_part('month', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as month_of_year,\n {{ dbt_date.month_name('d.date_day', short=false) }} as month_name,\n {{ dbt_date.month_name('d.date_day', short=true) }} as month_name_short,\n\n cast({{ dbt_utils.date_trunc('month', 'd.date_day') }} as date) as month_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'month') }} as date) as month_end_date,\n\n cast({{ dbt_utils.date_trunc('month', 'd.prior_year_date_day') }} as date) as prior_year_month_start_date,\n cast({{ dbt_utils.last_day('d.prior_year_date_day', 'month') }} as date) as prior_year_month_end_date,\n\n cast({{ dbt_date.date_part('quarter', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as quarter_of_year,\n cast({{ dbt_utils.date_trunc('quarter', 'd.date_day') }} as date) as quarter_start_date,\n {# dbt_utils.last_day does not support quarter because postgresql does not support quarter interval. #}\n cast({{dbt_utils.dateadd('day', '-1', dbt_utils.dateadd('month', '3', dbt_utils.date_trunc('quarter', 'd.date_day')))}} as date) as quarter_end_date,\n\n cast({{ dbt_date.date_part('year', 'd.date_day') }} as {{ dbt_utils.type_int() }}) as year_number,\n cast({{ dbt_utils.date_trunc('year', 'd.date_day') }} as date) as year_start_date,\n cast({{ dbt_utils.last_day('d.date_day', 'year') }} as date) as year_end_date\nfrom\n dates_with_prior_year_dates d\norder by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_base_dates", "macro.dbt_utils.dateadd", "macro.dbt_date.yesterday", "macro.dbt_date.tomorrow", "macro.dbt_date.day_of_week", "macro.dbt_date.day_name", "macro.dbt_date.day_of_month", "macro.dbt_date.day_of_year", "macro.dbt_date.week_start", "macro.dbt_date.week_end", "macro.dbt_date.week_of_year", "macro.dbt_date.iso_week_start", "macro.dbt_date.iso_week_end", "macro.dbt_date.iso_week_of_year", "macro.dbt_date.date_part", "macro.dbt_utils.type_int", "macro.dbt_date.month_name", "macro.dbt_utils.date_trunc", "macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.392247}, "macro.dbt_date.get_base_dates": {"unique_id": "macro.dbt_date.get_base_dates", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "get_base_dates", "macro_sql": "{% macro get_base_dates(start_date=None, end_date=None, n_dateparts=None, datepart=\"day\") %}\n {{ adapter.dispatch('get_base_dates', 'dbt_date') (start_date, end_date, n_dateparts, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__get_base_dates"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3949199}, "macro.dbt_date.default__get_base_dates": {"unique_id": "macro.dbt_date.default__get_base_dates", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "default__get_base_dates", "macro_sql": "{% macro default__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as \" ~ dbt_utils.type_timestamp() ~ \")\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as \" ~ dbt_utils.type_timestamp() ~ \")\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n {{ dbt_utils.date_spine(\n datepart=datepart,\n start_date=start_date,\n end_date=end_date,\n )\n }}\n\n)\nselect\n cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }}\nfrom\n date_spine d\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_utils.date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.3968499}, "macro.dbt_date.bigquery__get_base_dates": {"unique_id": "macro.dbt_date.bigquery__get_base_dates", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/get_base_dates.sql", "original_file_path": "macros/get_base_dates.sql", "name": "bigquery__get_base_dates", "macro_sql": "{% macro bigquery__get_base_dates(start_date, end_date, n_dateparts, datepart) %}\n\n{%- if start_date and end_date -%}\n{%- set start_date=\"cast('\" ~ start_date ~ \"' as date )\" -%}\n{%- set end_date=\"cast('\" ~ end_date ~ \"' as date )\" -%}\n\n{%- elif n_dateparts and datepart -%}\n\n{%- set start_date = dbt_utils.dateadd(datepart, -1 * n_dateparts, dbt_date.today()) -%}\n{%- set end_date = dbt_date.tomorrow() -%}\n{%- endif -%}\n\nwith date_spine as\n(\n\n {{ dbt_utils.date_spine(\n datepart=datepart,\n start_date=start_date,\n end_date=end_date,\n )\n }}\n\n)\nselect\n cast(d.date_{{ datepart }} as {{ dbt_utils.type_timestamp() }}) as date_{{ datepart }}\nfrom\n date_spine d\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_date.today", "macro.dbt_date.tomorrow", "macro.dbt_utils.date_spine", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.398578}, "macro.dbt_date.get_fiscal_year_dates": {"unique_id": "macro.dbt_date.get_fiscal_year_dates", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "name": "get_fiscal_year_dates", "macro_sql": "{% macro get_fiscal_year_dates(dates, year_end_month=12, week_start_day=1, shift_year=1) %}\n{{ adapter.dispatch('get_fiscal_year_dates', 'dbt_date') (dates, year_end_month, week_start_day, shift_year) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__get_fiscal_year_dates"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.401407}, "macro.dbt_date.default__get_fiscal_year_dates": {"unique_id": "macro.dbt_date.default__get_fiscal_year_dates", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_year_dates.sql", "original_file_path": "macros/fiscal_date/get_fiscal_year_dates.sql", "name": "default__get_fiscal_year_dates", "macro_sql": "{% macro default__get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) %}\n-- this gets all the dates within a fiscal year\n-- determined by the given year-end-month\n-- ending on the saturday closest to that month's end date\nwith date_dimension as (\n select * from {{ dates }}\n),\nyear_month_end as (\n\n select\n d.year_number - {{ shift_year }} as fiscal_year_number,\n d.month_end_date\n from\n date_dimension d\n where\n d.month_of_year = {{ year_end_month }}\n group by 1,2\n\n),\nweeks as (\n\n select\n d.year_number,\n d.month_of_year,\n d.date_day as week_start_date,\n cast({{ dbt_utils.dateadd('day', 6, 'd.date_day') }} as date) as week_end_date\n from\n date_dimension d\n where\n d.day_of_week = {{ week_start_day }}\n\n),\n-- get all the weeks that start in the month the year ends\nyear_week_ends as (\n\n select\n d.year_number - {{ shift_year }} as fiscal_year_number,\n d.week_end_date\n from\n weeks d\n where\n d.month_of_year = {{ year_end_month }}\n group by\n 1,2\n\n),\n-- then calculate which Saturday is closest to month end\nweeks_at_month_end as (\n\n select\n d.fiscal_year_number,\n d.week_end_date,\n m.month_end_date,\n rank() over\n (partition by d.fiscal_year_number\n order by\n abs({{ dbt_utils.datediff('d.week_end_date', 'm.month_end_date', 'day') }})\n\n ) as closest_to_month_end\n from\n year_week_ends d\n join\n year_month_end m on d.fiscal_year_number = m.fiscal_year_number\n),\nfiscal_year_range as (\n\n select\n w.fiscal_year_number,\n cast(\n {{ dbt_utils.dateadd('day', 1,\n 'lag(w.week_end_date) over(order by w.week_end_date)') }}\n as date) as fiscal_year_start_date,\n w.week_end_date as fiscal_year_end_date\n from\n weeks_at_month_end w\n where\n w.closest_to_month_end = 1\n\n),\nfiscal_year_dates as (\n\n select\n d.date_day,\n m.fiscal_year_number,\n m.fiscal_year_start_date,\n m.fiscal_year_end_date,\n w.week_start_date,\n w.week_end_date,\n -- we reset the weeks of the year starting with the merch year start date\n dense_rank()\n over(\n partition by m.fiscal_year_number\n order by w.week_start_date\n ) as fiscal_week_of_year\n from\n date_dimension d\n join\n fiscal_year_range m on d.date_day between m.fiscal_year_start_date and m.fiscal_year_end_date\n join\n weeks w on d.date_day between w.week_start_date and w.week_end_date\n\n)\nselect * from fiscal_year_dates order by 1\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4027798}, "macro.dbt_date.get_fiscal_periods": {"unique_id": "macro.dbt_date.get_fiscal_periods", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/fiscal_date/get_fiscal_periods.sql", "original_file_path": "macros/fiscal_date/get_fiscal_periods.sql", "name": "get_fiscal_periods", "macro_sql": "{% macro get_fiscal_periods(dates, year_end_month, week_start_day, shift_year=1) %}\n{# \nThis macro requires you to pass in a ref to a date dimension, created via\ndbt_date.get_date_dimension()s\n#}\nwith fscl_year_dates_for_periods as (\n {{ dbt_date.get_fiscal_year_dates(dates, year_end_month, week_start_day, shift_year) }}\n),\nfscl_year_w13 as (\n\n select\n f.*,\n -- We count the weeks in a 13 week period\n -- and separate the 4-5-4 week sequences\n mod(cast(\n (f.fiscal_week_of_year-1) as {{ dbt_utils.type_int() }}\n ), 13) as w13_number,\n -- Chop weeks into 13 week merch quarters\n cast(\n least(\n floor((f.fiscal_week_of_year-1)/13.0)\n , 3)\n as {{ dbt_utils.type_int() }}) as quarter_number\n from\n fscl_year_dates_for_periods f\n\n),\nfscl_periods as (\n\n select\n f.date_day,\n f.fiscal_year_number,\n f.week_start_date,\n f.week_end_date,\n f.fiscal_week_of_year,\n case \n -- we move week 53 into the 3rd period of the quarter\n when f.fiscal_week_of_year = 53 then 3\n when f.w13_number between 0 and 3 then 1\n when f.w13_number between 4 and 8 then 2\n when f.w13_number between 9 and 12 then 3\n end as period_of_quarter,\n f.quarter_number\n from\n fscl_year_w13 f\n\n),\nfscl_periods_quarters as (\n\n select\n f.*,\n cast((\n (f.quarter_number * 3) + f.period_of_quarter\n ) as {{ dbt_utils.type_int() }}) as fiscal_period_number\n from\n fscl_periods f\n\n)\nselect\n date_day,\n fiscal_year_number,\n week_start_date,\n week_end_date,\n fiscal_week_of_year, \n dense_rank() over(partition by fiscal_period_number order by fiscal_week_of_year) as fiscal_week_of_period,\n fiscal_period_number,\n quarter_number+1 as fiscal_quarter_number,\n period_of_quarter as fiscal_period_of_quarter\nfrom \n fscl_periods_quarters \norder by 1,2\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.get_fiscal_year_dates", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.404667}, "macro.dbt_date.tomorrow": {"unique_id": "macro.dbt_date.tomorrow", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/tomorrow.sql", "original_file_path": "macros/calendar_date/tomorrow.sql", "name": "tomorrow", "macro_sql": "{%- macro tomorrow(date=None, tz=None) -%}\n{{ dbt_date.n_days_away(1, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.405471}, "macro.dbt_date.next_week": {"unique_id": "macro.dbt_date.next_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_week.sql", "original_file_path": "macros/calendar_date/next_week.sql", "name": "next_week", "macro_sql": "{%- macro next_week(tz=None) -%}\n{{ dbt_date.n_weeks_away(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_weeks_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.406938}, "macro.dbt_date.next_month_name": {"unique_id": "macro.dbt_date.next_month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month_name.sql", "original_file_path": "macros/calendar_date/next_month_name.sql", "name": "next_month_name", "macro_sql": "{%- macro next_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.next_month(1, tz), short=short) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.month_name", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.407817}, "macro.dbt_date.next_month": {"unique_id": "macro.dbt_date.next_month", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month.sql", "original_file_path": "macros/calendar_date/next_month.sql", "name": "next_month", "macro_sql": "{%- macro next_month(tz=None) -%}\n{{ dbt_date.n_months_away(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_months_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.408431}, "macro.dbt_date.day_name": {"unique_id": "macro.dbt_date.day_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "day_name", "macro_sql": "{%- macro day_name(date, short=True) -%}\n {{ adapter.dispatch('day_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__day_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4097762}, "macro.dbt_date.default__day_name": {"unique_id": "macro.dbt_date.default__day_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "default__day_name", "macro_sql": "\n\n{%- macro default__day_name(date, short) -%}\n{%- set f = 'Dy' if short else 'Day' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4103281}, "macro.dbt_date.snowflake__day_name": {"unique_id": "macro.dbt_date.snowflake__day_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "snowflake__day_name", "macro_sql": "\n\n{%- macro snowflake__day_name(date, short) -%}\n {%- if short -%}\n dayname({{ date }})\n {%- else -%}\n -- long version not implemented on Snowflake so we're doing it manually :/\n case dayname({{ date }})\n when 'Mon' then 'Monday'\n when 'Tue' then 'Tuesday'\n when 'Wed' then 'Wednesday'\n when 'Thu' then 'Thursday'\n when 'Fri' then 'Friday'\n when 'Sat' then 'Saturday'\n when 'Sun' then 'Sunday'\n end\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.410877}, "macro.dbt_date.bigquery__day_name": {"unique_id": "macro.dbt_date.bigquery__day_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "bigquery__day_name", "macro_sql": "\n\n{%- macro bigquery__day_name(date, short) -%}\n{%- set f = '%a' if short else '%A' -%}\n format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.411399}, "macro.dbt_date.postgres__day_name": {"unique_id": "macro.dbt_date.postgres__day_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_name.sql", "original_file_path": "macros/calendar_date/day_name.sql", "name": "postgres__day_name", "macro_sql": "\n\n{%- macro postgres__day_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMDy' if short else 'FMDay' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.411926}, "macro.dbt_date.to_unixtimestamp": {"unique_id": "macro.dbt_date.to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "to_unixtimestamp", "macro_sql": "{%- macro to_unixtimestamp(timestamp) -%}\n {{ adapter.dispatch('to_unixtimestamp', 'dbt_date') (timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__to_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.412765}, "macro.dbt_date.default__to_unixtimestamp": {"unique_id": "macro.dbt_date.default__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "default__to_unixtimestamp", "macro_sql": "\n\n{%- macro default__to_unixtimestamp(timestamp) -%}\n {{ dbt_date.date_part('epoch', timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.413126}, "macro.dbt_date.snowflake__to_unixtimestamp": {"unique_id": "macro.dbt_date.snowflake__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "snowflake__to_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__to_unixtimestamp(timestamp) -%}\n {{ dbt_date.date_part('epoch_seconds', timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.41348}, "macro.dbt_date.bigquery__to_unixtimestamp": {"unique_id": "macro.dbt_date.bigquery__to_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/to_unixtimestamp.sql", "original_file_path": "macros/calendar_date/to_unixtimestamp.sql", "name": "bigquery__to_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__to_unixtimestamp(timestamp) -%}\n unix_seconds({{ timestamp }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4137568}, "macro.dbt_date.n_days_away": {"unique_id": "macro.dbt_date.n_days_away", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_days_away.sql", "original_file_path": "macros/calendar_date/n_days_away.sql", "name": "n_days_away", "macro_sql": "{%- macro n_days_away(n, date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(-1 * n, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.414596}, "macro.dbt_date.week_start": {"unique_id": "macro.dbt_date.week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "week_start", "macro_sql": "{%- macro week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.415811}, "macro.dbt_date.default__week_start": {"unique_id": "macro.dbt_date.default__week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "default__week_start", "macro_sql": "{%- macro default__week_start(date) -%}\ncast({{ dbt_utils.date_trunc('week', date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.416332}, "macro.dbt_date.snowflake__week_start": {"unique_id": "macro.dbt_date.snowflake__week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "snowflake__week_start", "macro_sql": "\n\n{%- macro snowflake__week_start(date) -%}\n {#\n Get the day of week offset: e.g. if the date is a Sunday,\n dbt_date.day_of_week returns 1, so we subtract 1 to get a 0 offset\n #}\n {% set off_set = dbt_date.day_of_week(date, isoweek=False) ~ \" - 1\" %}\n cast({{ dbt_utils.dateadd(\"day\", \"-1 * (\" ~ off_set ~ \")\", date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.day_of_week", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4170759}, "macro.dbt_date.postgres__week_start": {"unique_id": "macro.dbt_date.postgres__week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_start.sql", "original_file_path": "macros/calendar_date/week_start.sql", "name": "postgres__week_start", "macro_sql": "\n\n{%- macro postgres__week_start(date) -%}\n-- Sunday as week start date\ncast({{ dbt_utils.dateadd('day', -1, dbt_utils.date_trunc('week', dbt_utils.dateadd('day', 1, date))) }} as date)\n{%- endmacro %}", "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": 1644613438.417738}, "macro.dbt_date.iso_week_start": {"unique_id": "macro.dbt_date.iso_week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "iso_week_start", "macro_sql": "{%- macro iso_week_start(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_start', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.418987}, "macro.dbt_date._iso_week_start": {"unique_id": "macro.dbt_date._iso_week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "_iso_week_start", "macro_sql": "{%- macro _iso_week_start(date, week_type) -%}\ncast({{ dbt_utils.date_trunc(week_type, date) }} as date)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4193978}, "macro.dbt_date.default__iso_week_start": {"unique_id": "macro.dbt_date.default__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "default__iso_week_start", "macro_sql": "\n\n{%- macro default__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.419758}, "macro.dbt_date.snowflake__iso_week_start": {"unique_id": "macro.dbt_date.snowflake__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "snowflake__iso_week_start", "macro_sql": "\n\n{%- macro snowflake__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4201658}, "macro.dbt_date.postgres__iso_week_start": {"unique_id": "macro.dbt_date.postgres__iso_week_start", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_start.sql", "original_file_path": "macros/calendar_date/iso_week_start.sql", "name": "postgres__iso_week_start", "macro_sql": "\n\n{%- macro postgres__iso_week_start(date) -%}\n{{ dbt_date._iso_week_start(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_start"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4205198}, "macro.dbt_date.n_days_ago": {"unique_id": "macro.dbt_date.n_days_ago", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_days_ago.sql", "original_file_path": "macros/calendar_date/n_days_ago.sql", "name": "n_days_ago", "macro_sql": "{%- macro n_days_ago(n, date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{%- set n = n|int -%}\ncast({{ dbt_utils.dateadd('day', -1 * n, dt) }} as date)\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.421939}, "macro.dbt_date.last_week": {"unique_id": "macro.dbt_date.last_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/last_week.sql", "original_file_path": "macros/calendar_date/last_week.sql", "name": "last_week", "macro_sql": "{%- macro last_week(tz=None) -%}\n{{ dbt_date.n_weeks_ago(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_weeks_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.422682}, "macro.dbt_date.now": {"unique_id": "macro.dbt_date.now", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/now.sql", "original_file_path": "macros/calendar_date/now.sql", "name": "now", "macro_sql": "{%- macro now(tz=None) -%}\n{{ dbt_date.convert_timezone(dbt_utils.current_timestamp(), tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.convert_timezone", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.423449}, "macro.dbt_date.periods_since": {"unique_id": "macro.dbt_date.periods_since", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/periods_since.sql", "original_file_path": "macros/calendar_date/periods_since.sql", "name": "periods_since", "macro_sql": "{%- macro periods_since(date_col, period_name='day', tz=None) -%}\n{{ dbt_utils.datediff(date_col, dbt_date.today(tz), period_name) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.424243}, "macro.dbt_date.today": {"unique_id": "macro.dbt_date.today", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/today.sql", "original_file_path": "macros/calendar_date/today.sql", "name": "today", "macro_sql": "{%- macro today(tz=None) -%}\ncast({{ dbt_date.now(tz) }} as date)\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.424833}, "macro.dbt_date.last_month": {"unique_id": "macro.dbt_date.last_month", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month.sql", "original_file_path": "macros/calendar_date/last_month.sql", "name": "last_month", "macro_sql": "{%- macro last_month(tz=None) -%}\n{{ dbt_date.n_months_ago(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_months_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.425432}, "macro.dbt_date.day_of_year": {"unique_id": "macro.dbt_date.day_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "day_of_year", "macro_sql": "{%- macro day_of_year(date) -%}\n{{ adapter.dispatch('day_of_year', 'dbt_date') (date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.default__day_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4262679}, "macro.dbt_date.default__day_of_year": {"unique_id": "macro.dbt_date.default__day_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "default__day_of_year", "macro_sql": "\n\n{%- macro default__day_of_year(date) -%}\n {{ dbt_date.date_part('dayofyear', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.426625}, "macro.dbt_date.postgres__day_of_year": {"unique_id": "macro.dbt_date.postgres__day_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "postgres__day_of_year", "macro_sql": "\n\n{%- macro postgres__day_of_year(date) -%}\n {{ dbt_date.date_part('doy', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.426978}, "macro.dbt_date.redshift__day_of_year": {"unique_id": "macro.dbt_date.redshift__day_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_year.sql", "original_file_path": "macros/calendar_date/day_of_year.sql", "name": "redshift__day_of_year", "macro_sql": "\n\n{%- macro redshift__day_of_year(date) -%}\n cast({{ dbt_date.date_part('dayofyear', date) }} as {{ dbt_utils.type_bigint() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.427441}, "macro.dbt_date.last_month_start_date": {"unique_id": "macro.dbt_date.last_month_start_date", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month_start_date.sql", "original_file_path": "macros/calendar_date/last_month_start_date.sql", "name": "last_month_start_date", "macro_sql": "{%- macro last_month_start_date(tz=None) -%}\n{{ dbt_date.last_month(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.428041}, "macro.dbt_date.from_unixtimestamp": {"unique_id": "macro.dbt_date.from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "from_unixtimestamp", "macro_sql": "{%- macro from_unixtimestamp(epochs, format=\"seconds\") -%}\n {{ adapter.dispatch('from_unixtimestamp', 'dbt_date') (epochs, format) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__from_unixtimestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.430214}, "macro.dbt_date.default__from_unixtimestamp": {"unique_id": "macro.dbt_date.default__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "default__from_unixtimestamp", "macro_sql": "\n\n{%- macro default__from_unixtimestamp(epochs, format=\"seconds\") -%}\n {%- if format != \"seconds\" -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n to_timestamp({{ epochs }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4308732}, "macro.dbt_date.postgres__from_unixtimestamp": {"unique_id": "macro.dbt_date.postgres__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "postgres__from_unixtimestamp", "macro_sql": "\n\n{%- macro postgres__from_unixtimestamp(epochs, format=\"seconds\") -%}\n {%- if format != \"seconds\" -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n cast(to_timestamp({{ epochs }}) at time zone 'UTC' as timestamp)\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.431648}, "macro.dbt_date.snowflake__from_unixtimestamp": {"unique_id": "macro.dbt_date.snowflake__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "snowflake__from_unixtimestamp", "macro_sql": "\n\n{%- macro snowflake__from_unixtimestamp(epochs, format) -%}\n {%- if format == \"seconds\" -%}\n {%- set scale = 0 -%}\n {%- elif format == \"milliseconds\" -%}\n {%- set scale = 3 -%}\n {%- elif format == \"microseconds\" -%}\n {%- set scale = 6 -%}\n {%- else -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n to_timestamp_ntz({{ epochs }}, {{ scale }})\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.432995}, "macro.dbt_date.bigquery__from_unixtimestamp": {"unique_id": "macro.dbt_date.bigquery__from_unixtimestamp", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/from_unixtimestamp.sql", "original_file_path": "macros/calendar_date/from_unixtimestamp.sql", "name": "bigquery__from_unixtimestamp", "macro_sql": "\n\n{%- macro bigquery__from_unixtimestamp(epochs, format) -%}\n {%- if format == \"seconds\" -%}\n timestamp_seconds({{ epochs }})\n {%- elif format == \"milliseconds\" -%}\n timestamp_millis({{ epochs }})\n {%- elif format == \"microseconds\" -%}\n timestamp_micros({{ epochs }})\n {%- else -%}\n {{ exceptions.raise_compiler_error(\n \"value \" ~ format ~ \" for `format` for from_unixtimestamp is not supported.\"\n )\n }}\n {% endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.434033}, "macro.dbt_date.n_months_ago": {"unique_id": "macro.dbt_date.n_months_ago", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_months_ago.sql", "original_file_path": "macros/calendar_date/n_months_ago.sql", "name": "n_months_ago", "macro_sql": "{%- macro n_months_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('month', \n dbt_utils.dateadd('month', -1 * n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.435104}, "macro.dbt_date.date_part": {"unique_id": "macro.dbt_date.date_part", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "date_part", "macro_sql": "{% macro date_part(datepart, date) -%}\n {{ adapter.dispatch('date_part', 'dbt_date') (datepart, date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4359381}, "macro.dbt_date.default__date_part": {"unique_id": "macro.dbt_date.default__date_part", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "default__date_part", "macro_sql": "{% macro default__date_part(datepart, date) -%}\n date_part('{{ datepart }}', {{ date }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4362838}, "macro.dbt_date.bigquery__date_part": {"unique_id": "macro.dbt_date.bigquery__date_part", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/date_part.sql", "original_file_path": "macros/calendar_date/date_part.sql", "name": "bigquery__date_part", "macro_sql": "{% macro bigquery__date_part(datepart, date) -%}\n extract({{ datepart }} from {{ date }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4366348}, "macro.dbt_date.n_weeks_away": {"unique_id": "macro.dbt_date.n_weeks_away", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_weeks_away.sql", "original_file_path": "macros/calendar_date/n_weeks_away.sql", "name": "n_weeks_away", "macro_sql": "{%- macro n_weeks_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('week', \n dbt_utils.dateadd('week', n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.43765}, "macro.dbt_date.day_of_month": {"unique_id": "macro.dbt_date.day_of_month", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "name": "day_of_month", "macro_sql": "{%- macro day_of_month(date) -%}\n{{ dbt_date.date_part('day', date) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.438415}, "macro.dbt_date.redshift__day_of_month": {"unique_id": "macro.dbt_date.redshift__day_of_month", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_month.sql", "original_file_path": "macros/calendar_date/day_of_month.sql", "name": "redshift__day_of_month", "macro_sql": "\n\n{%- macro redshift__day_of_month(date) -%}\ncast({{ dbt_date.date_part('day', date) }} as {{ dbt_utils.type_bigint() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.43898}, "macro.dbt_date.yesterday": {"unique_id": "macro.dbt_date.yesterday", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/yesterday.sql", "original_file_path": "macros/calendar_date/yesterday.sql", "name": "yesterday", "macro_sql": "{%- macro yesterday(date=None, tz=None) -%}\n{{ dbt_date.n_days_ago(1, date, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.n_days_ago"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.439688}, "macro.dbt_date.day_of_week": {"unique_id": "macro.dbt_date.day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "day_of_week", "macro_sql": "{%- macro day_of_week(date, isoweek=true) -%}\n{{ adapter.dispatch('day_of_week', 'dbt_date') (date, isoweek) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__day_of_week"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.442881}, "macro.dbt_date.default__day_of_week": {"unique_id": "macro.dbt_date.default__day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "default__day_of_week", "macro_sql": "\n\n{%- macro default__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (0) to Monday (1)\n when {{ dow }} = 0 then 7\n else {{ dow }}\n end\n {%- else -%}\n {{ dow }} + 1\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.443638}, "macro.dbt_date.snowflake__day_of_week": {"unique_id": "macro.dbt_date.snowflake__day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "snowflake__day_of_week", "macro_sql": "\n\n{%- macro snowflake__day_of_week(date, isoweek) -%}\n\n {%- if isoweek -%}\n {%- set dow_part = 'dayofweekiso' -%}\n {{ dbt_date.date_part(dow_part, date) }}\n {%- else -%}\n {%- set dow_part = 'dayofweek' -%}\n case\n when {{ dbt_date.date_part(dow_part, date) }} = 7 then 1\n else {{ dbt_date.date_part(dow_part, date) }} + 1\n end\n {%- endif -%}\n\n\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.444693}, "macro.dbt_date.bigquery__day_of_week": {"unique_id": "macro.dbt_date.bigquery__day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "bigquery__day_of_week", "macro_sql": "\n\n{%- macro bigquery__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (1) to Monday (2)\n when {{ dow }} = 1 then 7\n else {{ dow }} - 1\n end\n {%- else -%}\n {{ dow }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.44543}, "macro.dbt_date.postgres__day_of_week": {"unique_id": "macro.dbt_date.postgres__day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "postgres__day_of_week", "macro_sql": "\n\n\n{%- macro postgres__day_of_week(date, isoweek) -%}\n\n {%- if isoweek -%}\n {%- set dow_part = 'isodow' -%}\n -- Monday(1) to Sunday (7)\n cast({{ dbt_date.date_part(dow_part, date) }} as {{ dbt_utils.type_int() }})\n {%- else -%}\n {%- set dow_part = 'dow' -%}\n -- Sunday(1) to Saturday (7)\n cast({{ dbt_date.date_part(dow_part, date) }} + 1 as {{ dbt_utils.type_int() }})\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.446562}, "macro.dbt_date.redshift__day_of_week": {"unique_id": "macro.dbt_date.redshift__day_of_week", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/day_of_week.sql", "original_file_path": "macros/calendar_date/day_of_week.sql", "name": "redshift__day_of_week", "macro_sql": "\n\n\n{%- macro redshift__day_of_week(date, isoweek) -%}\n\n {%- set dow = dbt_date.date_part('dayofweek', date) -%}\n\n {%- if isoweek -%}\n case\n -- Shift start of week from Sunday (0) to Monday (1)\n when {{ dow }} = 0 then 7\n else cast({{ dow }} as {{ dbt_utils.type_bigint() }})\n end\n {%- else -%}\n cast({{ dow }} + 1 as {{ dbt_utils.type_bigint() }})\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.447523}, "macro.dbt_date.iso_week_end": {"unique_id": "macro.dbt_date.iso_week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "iso_week_end", "macro_sql": "{%- macro iso_week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.449057}, "macro.dbt_date._iso_week_end": {"unique_id": "macro.dbt_date._iso_week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "_iso_week_end", "macro_sql": "{%- macro _iso_week_end(date, week_type) -%}\n{%- set dt = dbt_date.iso_week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.iso_week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.449596}, "macro.dbt_date.default__iso_week_end": {"unique_id": "macro.dbt_date.default__iso_week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "default__iso_week_end", "macro_sql": "\n\n{%- macro default__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.44995}, "macro.dbt_date.snowflake__iso_week_end": {"unique_id": "macro.dbt_date.snowflake__iso_week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_end.sql", "original_file_path": "macros/calendar_date/iso_week_end.sql", "name": "snowflake__iso_week_end", "macro_sql": "\n\n{%- macro snowflake__iso_week_end(date) -%}\n{{ dbt_date._iso_week_end(date, 'weekiso') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.450308}, "macro.dbt_date.next_month_start_date": {"unique_id": "macro.dbt_date.next_month_start_date", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month_start_date.sql", "original_file_path": "macros/calendar_date/next_month_start_date.sql", "name": "next_month_start_date", "macro_sql": "{%- macro next_month_start_date(tz=None) -%}\n{{ dbt_date.next_month(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.450913}, "macro.dbt_date.n_weeks_ago": {"unique_id": "macro.dbt_date.n_weeks_ago", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_weeks_ago.sql", "original_file_path": "macros/calendar_date/n_weeks_ago.sql", "name": "n_weeks_ago", "macro_sql": "{%- macro n_weeks_ago(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('week', \n dbt_utils.dateadd('week', -1 * n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.451968}, "macro.dbt_date.month_name": {"unique_id": "macro.dbt_date.month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "month_name", "macro_sql": "{%- macro month_name(date, short=True) -%}\n {{ adapter.dispatch('month_name', 'dbt_date') (date, short) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__month_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4531069}, "macro.dbt_date.default__month_name": {"unique_id": "macro.dbt_date.default__month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "default__month_name", "macro_sql": "\n\n{%- macro default__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MONTH' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4537501}, "macro.dbt_date.bigquery__month_name": {"unique_id": "macro.dbt_date.bigquery__month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "bigquery__month_name", "macro_sql": "\n\n{%- macro bigquery__month_name(date, short) -%}\n{%- set f = '%b' if short else '%B' -%}\n format_date('{{ f }}', cast({{ date }} as date))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4544}, "macro.dbt_date.snowflake__month_name": {"unique_id": "macro.dbt_date.snowflake__month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "snowflake__month_name", "macro_sql": "\n\n{%- macro snowflake__month_name(date, short) -%}\n{%- set f = 'MON' if short else 'MMMM' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4551811}, "macro.dbt_date.postgres__month_name": {"unique_id": "macro.dbt_date.postgres__month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/month_name.sql", "original_file_path": "macros/calendar_date/month_name.sql", "name": "postgres__month_name", "macro_sql": "\n\n{%- macro postgres__month_name(date, short) -%}\n{# FM = Fill mode, which suppresses padding blanks #}\n{%- set f = 'FMMon' if short else 'FMMonth' -%}\n to_char({{ date }}, '{{ f }}')\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.456084}, "macro.dbt_date.last_month_name": {"unique_id": "macro.dbt_date.last_month_name", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month_name.sql", "original_file_path": "macros/calendar_date/last_month_name.sql", "name": "last_month_name", "macro_sql": "{%- macro last_month_name(short=True, tz=None) -%}\n{{ dbt_date.month_name(dbt_date.lastnext_month(1, tz), short=short) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.month_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.456917}, "macro.dbt_date.week_of_year": {"unique_id": "macro.dbt_date.week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "week_of_year", "macro_sql": "{%- macro week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4580421}, "macro.dbt_date.default__week_of_year": {"unique_id": "macro.dbt_date.default__week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "default__week_of_year", "macro_sql": "{%- macro default__week_of_year(date) -%}\ncast({{ dbt_date.date_part('week', date) }} as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.458516}, "macro.dbt_date.postgres__week_of_year": {"unique_id": "macro.dbt_date.postgres__week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_of_year.sql", "original_file_path": "macros/calendar_date/week_of_year.sql", "name": "postgres__week_of_year", "macro_sql": "\n\n{%- macro postgres__week_of_year(date) -%}\n{# postgresql 'week' returns isoweek. Use to_char instead.\n WW = the first week starts on the first day of the year #}\ncast(to_char({{ date }}, 'WW') as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.459003}, "macro.dbt_date.convert_timezone": {"unique_id": "macro.dbt_date.convert_timezone", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "convert_timezone", "macro_sql": "{%- macro convert_timezone(column, target_tz=None, source_tz=None) -%}\n{%- set source_tz = \"UTC\" if not source_tz else source_tz -%}\n{%- set target_tz = var(\"dbt_date:time_zone\") if not target_tz else target_tz -%}\n{{ adapter.dispatch('convert_timezone', 'dbt_date') (column, target_tz, source_tz) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.bigquery__convert_timezone"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.461796}, "macro.dbt_date.default__convert_timezone": {"unique_id": "macro.dbt_date.default__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "default__convert_timezone", "macro_sql": "{% macro default__convert_timezone(column, target_tz, source_tz) -%}\n{%- if not source_tz -%}\ncast(convert_timezone('{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }})\n{%- else -%}\ncast(convert_timezone('{{ source_tz }}', '{{ target_tz }}', {{ column }}) as {{ dbt_utils.type_timestamp() }})\n{%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.462684}, "macro.dbt_date.bigquery__convert_timezone": {"unique_id": "macro.dbt_date.bigquery__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "bigquery__convert_timezone", "macro_sql": "{%- macro bigquery__convert_timezone(column, target_tz, source_tz=None) -%}\ntimestamp(datetime({{ column }}, '{{ target_tz}}'))\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.463082}, "macro.dbt_date.spark__convert_timezone": {"unique_id": "macro.dbt_date.spark__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{%- macro spark__convert_timezone(column, target_tz, source_tz) -%}\nfrom_utc_timestamp(\n to_utc_timestamp({{ column }}, '{{ source_tz }}'),\n '{{ target_tz }}'\n )\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.463506}, "macro.dbt_date.postgres__convert_timezone": {"unique_id": "macro.dbt_date.postgres__convert_timezone", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/convert_timezone.sql", "original_file_path": "macros/calendar_date/convert_timezone.sql", "name": "postgres__convert_timezone", "macro_sql": "{% macro postgres__convert_timezone(column, target_tz, source_tz) -%}\n{%- if source_tz -%}\ncast({{ column }} at time zone '{{ source_tz }}' at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }})\n{%- else -%}\ncast({{ column }} at time zone '{{ target_tz }}' as {{ dbt_utils.type_timestamp() }})\n{%- endif -%}\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": 1644613438.464352}, "macro.dbt_date.n_months_away": {"unique_id": "macro.dbt_date.n_months_away", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/n_months_away.sql", "original_file_path": "macros/calendar_date/n_months_away.sql", "name": "n_months_away", "macro_sql": "{%- macro n_months_away(n, tz=None) -%}\n{%- set n = n|int -%}\n{{ dbt_utils.date_trunc('month', \n dbt_utils.dateadd('month', n, \n dbt_date.today(tz)\n )\n ) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_date.today"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.465377}, "macro.dbt_date.next_week_start_date": {"unique_id": "macro.dbt_date.next_week_start_date", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_week_start_date.sql", "original_file_path": "macros/calendar_date/next_week_start_date.sql", "name": "next_week_start_date", "macro_sql": "{%- macro next_week_start_date(tz=None) -%}\n{{ dbt_date.next_week(1, tz) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.next_week"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.465986}, "macro.dbt_date.iso_week_of_year": {"unique_id": "macro.dbt_date.iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "iso_week_of_year", "macro_sql": "{%- macro iso_week_of_year(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('iso_week_of_year', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.467286}, "macro.dbt_date._iso_week_of_year": {"unique_id": "macro.dbt_date._iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "_iso_week_of_year", "macro_sql": "{%- macro _iso_week_of_year(date, week_type) -%}\ncast({{ dbt_date.date_part(week_type, date) }} as {{ dbt_utils.type_int() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.467787}, "macro.dbt_date.default__iso_week_of_year": {"unique_id": "macro.dbt_date.default__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "default__iso_week_of_year", "macro_sql": "\n\n{%- macro default__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'isoweek') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.468148}, "macro.dbt_date.snowflake__iso_week_of_year": {"unique_id": "macro.dbt_date.snowflake__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "snowflake__iso_week_of_year", "macro_sql": "\n\n{%- macro snowflake__iso_week_of_year(date) -%}\n{{ dbt_date._iso_week_of_year(date, 'weekiso') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.468509}, "macro.dbt_date.postgres__iso_week_of_year": {"unique_id": "macro.dbt_date.postgres__iso_week_of_year", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/iso_week_of_year.sql", "original_file_path": "macros/calendar_date/iso_week_of_year.sql", "name": "postgres__iso_week_of_year", "macro_sql": "\n\n{%- macro postgres__iso_week_of_year(date) -%}\n-- postgresql week is isoweek, the first week of a year containing January 4 of that year.\n{{ dbt_date._iso_week_of_year(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date._iso_week_of_year"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.46888}, "macro.dbt_date.week_end": {"unique_id": "macro.dbt_date.week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "week_end", "macro_sql": "{%- macro week_end(date=None, tz=None) -%}\n{%-set dt = date if date else dbt_date.today(tz) -%}\n{{ adapter.dispatch('week_end', 'dbt_date') (dt) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_date.default__week_end"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4700701}, "macro.dbt_date.default__week_end": {"unique_id": "macro.dbt_date.default__week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "default__week_end", "macro_sql": "{%- macro default__week_end(date) -%}\n{{ dbt_utils.last_day(date, 'week') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.470434}, "macro.dbt_date.snowflake__week_end": {"unique_id": "macro.dbt_date.snowflake__week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "snowflake__week_end", "macro_sql": "\n\n{%- macro snowflake__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.47095}, "macro.dbt_date.postgres__week_end": {"unique_id": "macro.dbt_date.postgres__week_end", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/week_end.sql", "original_file_path": "macros/calendar_date/week_end.sql", "name": "postgres__week_end", "macro_sql": "\n\n{%- macro postgres__week_end(date) -%}\n{%- set dt = dbt_date.week_start(date) -%}\n{{ dbt_date.n_days_away(6, dt) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.week_start", "macro.dbt_date.n_days_away"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.471575}, "macro.dbt_date.next_month_number": {"unique_id": "macro.dbt_date.next_month_number", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/next_month_number.sql", "original_file_path": "macros/calendar_date/next_month_number.sql", "name": "next_month_number", "macro_sql": "{%- macro next_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.next_month(1, tz)) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.next_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.472329}, "macro.dbt_date.last_month_number": {"unique_id": "macro.dbt_date.last_month_number", "package_name": "dbt_date", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_date", "path": "macros/calendar_date/last_month_number.sql", "original_file_path": "macros/calendar_date/last_month_number.sql", "name": "last_month_number", "macro_sql": "{%- macro last_month_number(tz=None) -%}\n{{ dbt_date.date_part('month', dbt_date.last_month(1, tz)) }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.date_part", "macro.dbt_date.last_month"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.473217}, "macro.google_ads_source.get_ad_group_history_columns": {"unique_id": "macro.google_ads_source.get_ad_group_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_rotation_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"base_ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_custom_bid_dimension\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"explorer_auto_optimizer_setting_opt_in\", \"datatype\": \"boolean\"},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"target_restrictions\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"type\", \"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": 1644613438.477382}, "macro.google_ads_source.get_campaign_history_columns": {"unique_id": "macro.google_ads_source.get_campaign_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_serving_optimization_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertising_channel_subtype\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertising_channel_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"base_campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"end_date\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"experiment_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency_caps\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"optimization_score\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"payment_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"serving_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"start_date\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"vanity_pharma_display_url_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"vanity_pharma_text\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"video_brand_safety_suitability\", \"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", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.4832692}, "macro.google_ads_source.get_ad_stats_columns": {"unique_id": "macro.google_ads_source.get_ad_stats_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_ad_stats_columns.sql", "original_file_path": "macros/get_ad_stats_columns.sql", "name": "get_ad_stats_columns", "macro_sql": "{% macro get_ad_stats_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active_view_impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_measurability\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"active_view_measurable_cost_micros\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_measurable_impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"active_view_viewability\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ad_group\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_base_ad_group\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_network_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_base_campaign\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"conversions\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"conversions_value\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_micros\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"date\", \"datatype\": \"date\"},\n {\"name\": \"device\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"interaction_event_types\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"interactions\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"keyword_ad_group_criterion\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"view_through_conversions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.490228}, "macro.google_ads_source.get_ad_final_url_history_columns": {"unique_id": "macro.google_ads_source.get_ad_final_url_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_ad_final_url_history_columns.sql", "original_file_path": "macros/get_ad_final_url_history_columns.sql", "name": "get_ad_final_url_history_columns", "macro_sql": "{% macro get_ad_final_url_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"sequence_id\", \"datatype\": dbt_utils.type_int()},\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": 1644613438.492809}, "macro.google_ads_source.get_account_history_columns": {"unique_id": "macro.google_ads_source.get_account_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_account_history_columns.sql", "original_file_path": "macros/get_account_history_columns.sql", "name": "get_account_history_columns", "macro_sql": "{% macro get_account_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"auto_tagging_enabled\", \"datatype\": \"boolean\"},\n {\"name\": \"currency_code\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"descriptive_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"hidden\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"manager\", \"datatype\": \"boolean\"},\n {\"name\": \"manager_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"optimization_score\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"pay_per_conversion_eligibility_failure_reasons\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"test_account\", \"datatype\": \"boolean\"},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"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", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.496908}, "macro.google_ads_source.get_ad_history_columns": {"unique_id": "macro.google_ads_source.get_ad_history_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"action_items\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_strength\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"added_by_google_ads\", \"datatype\": \"boolean\"},\n {\"name\": \"device_preference\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_app_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_mobile_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_url_suffix\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"final_urls\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"policy_summary_approval_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"policy_summary_review_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_managed_resource_source\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"tracking_url_template\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url_collections\", \"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": 1644613438.502866}, "macro.google_ads_source.get_final_url_performance_columns": {"unique_id": "macro.google_ads_source.get_final_url_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_final_url_performance_columns", "macro_sql": "{% macro get_final_url_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"cost\", \"datatype\": dbt_utils.type_float(), \"alias\": \"spend\"},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"effective_final_url\", \"datatype\": dbt_utils.type_string(), \"alias\": \"final_url\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"impressions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.509071}, "macro.google_ads_source.get_click_performance_columns": {"unique_id": "macro.google_ads_source.get_click_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_click_performance_columns", "macro_sql": "{% macro get_click_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"criteria_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"gcl_id\", \"datatype\": dbt_utils.type_string(), \"alias\": \"gclid\"}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.5129411}, "macro.google_ads_source.get_criteria_performance_columns": {"unique_id": "macro.google_ads_source.get_criteria_performance_columns", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "macros/staging_columns.sql", "original_file_path": "macros/staging_columns.sql", "name": "get_criteria_performance_columns", "macro_sql": "{% macro get_criteria_performance_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"account_descriptive_name\", \"datatype\": dbt_utils.type_string(), \"alias\": \"account_name\"},\n {\"name\": \"ad_group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ad_group_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_group_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"cost\", \"datatype\": dbt_utils.type_float(), \"alias\": \"spend\"},\n {\"name\": \"criteria\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"criteria_destination_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"criteria_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"date\", \"datatype\": \"date\", \"alias\": \"date_day\"},\n {\"name\": \"external_customer_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"impressions\", \"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_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.5178308}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.519099}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5207858}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.521211}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.521634}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5221472}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5228732}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.524012}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5254688}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.527345}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.529803}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.530455}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.53114}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.531756}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.532371}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5330582}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.533747}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.534636}, "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/GoogleAds/development/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": 1644613438.534904}, "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/GoogleAds/development/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": 1644613438.5351691}, "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/GoogleAds/development/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": 1644613438.535433}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.536569}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.538292}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.540173}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.54124}, "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/GoogleAds/development/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": 1644613438.541576}, "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/GoogleAds/development/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": 1644613438.541944}, "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/GoogleAds/development/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": 1644613438.542271}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.542607}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.547124}, "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/GoogleAds/development/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": 1644613438.547542}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.547955}, "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/GoogleAds/development/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": 1644613438.5483541}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5531049}, "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/GoogleAds/development/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": 1644613438.556679}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5577972}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5592918}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.560627}, "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/GoogleAds/development/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": 1644613438.561147}, "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/GoogleAds/development/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": 1644613438.561716}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.562476}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5645592}, "macro.fivetran_utils.staging_models_automation": {"unique_id": "macro.fivetran_utils.staging_models_automation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.56795}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.58005}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.581176}, "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/GoogleAds/development/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": 1644613438.582548}, "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/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.584844}, "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/GoogleAds/development/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": 1644613438.586051}, "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/GoogleAds/development/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": 1644613438.586603}, "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/GoogleAds/development/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": 1644613438.590178}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.591576}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5929348}, "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/GoogleAds/development/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": 1644613438.5934}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.593842}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.594322}, "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/GoogleAds/development/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": 1644613438.5947142}, "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/GoogleAds/development/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": 1644613438.595098}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.596736}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.5992389}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.600632}, "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/GoogleAds/development/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": 1644613438.601088}, "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/GoogleAds/development/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": 1644613438.601492}, "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/GoogleAds/development/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": 1644613438.601901}, "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/GoogleAds/development/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": 1644613438.6023061}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.602748}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.603473}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.603737}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.604118}, "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/GoogleAds/development/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": 1644613438.606134}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.609514}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.614082}, "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/GoogleAds/development/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": 1644613438.6176472}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.618411}, "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/GoogleAds/development/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": 1644613438.61868}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/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": 1644613438.618946}, "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/GoogleAds/development/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": 1644613438.6201441}, "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/GoogleAds/development/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": 1644613438.621682}, "macro.dbt_expectations.postgres__type_timestamp": {"unique_id": "macro.dbt_expectations.postgres__type_timestamp", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() -%}\n timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.62238}, "macro.dbt_expectations.type_datetime": {"unique_id": "macro.dbt_expectations.type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "type_datetime", "macro_sql": "\n\n\n\n{%- macro type_datetime() -%}\n {{ return(adapter.dispatch('type_datetime', 'dbt_expectations')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__type_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6231098}, "macro.dbt_expectations.default__type_datetime": {"unique_id": "macro.dbt_expectations.default__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "default__type_datetime", "macro_sql": "{% macro default__type_datetime() -%}\n datetime\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.623328}, "macro.dbt_expectations.snowflake__type_datetime": {"unique_id": "macro.dbt_expectations.snowflake__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "snowflake__type_datetime", "macro_sql": "{% macro snowflake__type_datetime() -%}\n timestamp_ntz\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.623523}, "macro.dbt_expectations.postgres__type_datetime": {"unique_id": "macro.dbt_expectations.postgres__type_datetime", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/utils/datatypes.sql", "original_file_path": "macros/utils/datatypes.sql", "name": "postgres__type_datetime", "macro_sql": "{% macro postgres__type_datetime() -%}\n timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6238542}, "macro.dbt_expectations.regexp_instr": {"unique_id": "macro.dbt_expectations.regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "regexp_instr", "macro_sql": "{% macro regexp_instr(source_value, regexp, position=1, occurrence=1) %}\n\n {{ adapter.dispatch('regexp_instr', 'dbt_expectations')(\n source_value, regexp, position, occurrence\n ) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__regexp_instr"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6252632}, "macro.dbt_expectations.default__regexp_instr": {"unique_id": "macro.dbt_expectations.default__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "default__regexp_instr", "macro_sql": "{% macro default__regexp_instr(source_value, regexp, position, occurrence) %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.625812}, "macro.dbt_expectations.redshift__regexp_instr": {"unique_id": "macro.dbt_expectations.redshift__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "redshift__regexp_instr", "macro_sql": "{% macro redshift__regexp_instr(source_value, regexp, position, occurrence) %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6263082}, "macro.dbt_expectations.postgres__regexp_instr": {"unique_id": "macro.dbt_expectations.postgres__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "postgres__regexp_instr", "macro_sql": "{% macro postgres__regexp_instr(source_value, regexp, position, occurrence) %}\narray_length((select regexp_matches({{ source_value }}, '{{ regexp }}')), 1)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.626702}, "macro.dbt_expectations.spark__regexp_instr": {"unique_id": "macro.dbt_expectations.spark__regexp_instr", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "name": "spark__regexp_instr", "macro_sql": "{% macro spark__regexp_instr(source_value, regexp, position, occurrence) %}\ncase when {{ source_value }} rlike '{{ regexp }}' then 1 else 0 end\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6270988}, "macro.dbt_expectations.log_natural": {"unique_id": "macro.dbt_expectations.log_natural", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "log_natural", "macro_sql": "{% macro log_natural(x) -%}\n {{ adapter.dispatch('log_natural', 'dbt_expectations') (x) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.bigquery__log_natural"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.627933}, "macro.dbt_expectations.default__log_natural": {"unique_id": "macro.dbt_expectations.default__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "default__log_natural", "macro_sql": "{% macro default__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.628253}, "macro.dbt_expectations.bigquery__log_natural": {"unique_id": "macro.dbt_expectations.bigquery__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "bigquery__log_natural", "macro_sql": "{% macro bigquery__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.628601}, "macro.dbt_expectations.snowflake__log_natural": {"unique_id": "macro.dbt_expectations.snowflake__log_natural", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "name": "snowflake__log_natural", "macro_sql": "{% macro snowflake__log_natural(x) %}\n\n ln({{ x }})\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.629028}, "macro.dbt_expectations.rand": {"unique_id": "macro.dbt_expectations.rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "rand", "macro_sql": "{% macro rand() -%}\n {{ adapter.dispatch('rand', 'dbt_expectations') () }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.bigquery__rand"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.630055}, "macro.dbt_expectations.default__rand": {"unique_id": "macro.dbt_expectations.default__rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "default__rand", "macro_sql": "{% macro default__rand() %}\n\n rand()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.630288}, "macro.dbt_expectations.bigquery__rand": {"unique_id": "macro.dbt_expectations.bigquery__rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "bigquery__rand", "macro_sql": "{% macro bigquery__rand() %}\n\n rand()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.630477}, "macro.dbt_expectations.snowflake__rand": {"unique_id": "macro.dbt_expectations.snowflake__rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "snowflake__rand", "macro_sql": "{% macro snowflake__rand(seed) %}\n\n uniform(0::float, 1::float, random())\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.630686}, "macro.dbt_expectations.postgres__rand": {"unique_id": "macro.dbt_expectations.postgres__rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "postgres__rand", "macro_sql": "{% macro postgres__rand() %}\n\n random()\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6308742}, "macro.dbt_expectations.redshift__rand": {"unique_id": "macro.dbt_expectations.redshift__rand", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "name": "redshift__rand", "macro_sql": "{% macro redshift__rand() %}\n\n random()\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.631061}, "macro.dbt_expectations.median": {"unique_id": "macro.dbt_expectations.median", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/median.sql", "original_file_path": "macros/math/median.sql", "name": "median", "macro_sql": "{% macro median(field) %}\n{{ dbt_expectations.percentile_cont(field, 0.5) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.631705}, "macro.dbt_expectations.percentile_cont": {"unique_id": "macro.dbt_expectations.percentile_cont", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "percentile_cont", "macro_sql": "{% macro percentile_cont(field, quantile, partition=None) %}\n {{ adapter.dispatch('quantile', 'dbt_expectations') (field, quantile, partition) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.bigquery__quantile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.632973}, "macro.dbt_expectations.default__quantile": {"unique_id": "macro.dbt_expectations.default__quantile", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "default__quantile", "macro_sql": "{% macro default__quantile(field, quantile, partition) -%}\n percentile_cont({{ quantile }}) within group (order by {{ field }})\n {%- if partition %}over(partition by {{ partition }}){% endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6336079}, "macro.dbt_expectations.bigquery__quantile": {"unique_id": "macro.dbt_expectations.bigquery__quantile", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "name": "bigquery__quantile", "macro_sql": "{% macro bigquery__quantile(field, quantile, partition) %}\n percentile_cont({{ field }}, {{ quantile }})\n over({%- if partition %}partition by {{ partition }}{% endif -%})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.634192}, "macro.dbt_expectations.test_expression_between": {"unique_id": "macro.dbt_expectations.test_expression_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "name": "test_expression_between", "macro_sql": "{% test expression_between(model,\n expression,\n min_value=None,\n max_value=None,\n group_by_columns=None,\n row_condition=None,\n strictly=False\n ) %}\n\n {{ dbt_expectations.expression_between(model, expression, min_value, max_value, group_by_columns, row_condition, strictly) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6364212}, "macro.dbt_expectations.expression_between": {"unique_id": "macro.dbt_expectations.expression_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "name": "expression_between", "macro_sql": "{% macro expression_between(model,\n expression,\n min_value,\n max_value,\n group_by_columns,\n row_condition,\n strictly\n ) %}\n\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n\n{%- set strict_operator = \"\" if strictly else \"=\" -%}\n\n{% set expression_min_max %}\n( 1=1\n{%- if min_value is not none %} and {{ expression | trim }} >{{ strict_operator }} {{ min_value }}{% endif %}\n{%- if max_value is not none %} and {{ expression | trim }} <{{ strict_operator }} {{ max_value }}{% endif %}\n)\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression_min_max,\n group_by_columns=group_by_columns,\n row_condition=row_condition)\n }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.638866}, "macro.dbt_expectations.test_expression_is_true": {"unique_id": "macro.dbt_expectations.test_expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n\n {{ dbt_expectations.expression_is_true(model, expression, test_condition, group_by_columns, row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.641619}, "macro.dbt_expectations.expression_is_true": {"unique_id": "macro.dbt_expectations.expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "expression_is_true", "macro_sql": "{% macro expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n {{ adapter.dispatch('expression_is_true', 'dbt_expectations') (model, expression, test_condition, group_by_columns, row_condition) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6424031}, "macro.dbt_expectations.default__expression_is_true": {"unique_id": "macro.dbt_expectations.default__expression_is_true", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "name": "default__expression_is_true", "macro_sql": "{% macro default__expression_is_true(model, expression, test_condition, group_by_columns, row_condition) -%}\nwith grouped_expression as (\n select\n {% if group_by_columns %}\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ dbt_expectations.truth_expression(expression) }}\n from {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by_columns %}\n group by\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression {{ test_condition }})\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.644018}, "macro.dbt_expectations.get_select": {"unique_id": "macro.dbt_expectations.get_select", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "get_select", "macro_sql": "{% macro get_select(model, expression, row_condition, group_by) -%}\n {{ adapter.dispatch('get_select', 'dbt_expectations') (model, expression, row_condition, group_by) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__get_select"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6532412}, "macro.dbt_expectations.default__get_select": {"unique_id": "macro.dbt_expectations.default__get_select", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "default__get_select", "macro_sql": "\n\n{%- macro default__get_select(model, expression, row_condition, group_by) %}\n select\n {% if group_by %}\n {% for g in group_by -%}\n {{ g }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ expression }} as expression\n from\n {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by %}\n group by\n {% for g in group_by -%}\n {{ loop.index }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n{% endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.654968}, "macro.dbt_expectations.test_equal_expression": {"unique_id": "macro.dbt_expectations.test_equal_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "test_equal_expression", "macro_sql": "{% test equal_expression(model, expression,\n compare_model=None,\n compare_expression=None,\n group_by=None,\n compare_group_by=None,\n row_condition=None,\n compare_row_condition=None,\n tolerance=0.0,\n tolerance_percent=None,\n return_difference=False\n ) -%}\n\n {{ adapter.dispatch('test_equal_expression', 'dbt_expectations') (\n model, expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent,\n return_difference) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6566389}, "macro.dbt_expectations.default__test_equal_expression": {"unique_id": "macro.dbt_expectations.default__test_equal_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "name": "default__test_equal_expression", "macro_sql": "\n\n{%- macro default__test_equal_expression(\n model, expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent,\n return_difference) -%}\n\n {%- set compare_model = model if not compare_model else compare_model -%}\n {%- set compare_expression = expression if not compare_expression else compare_expression -%}\n {%- set compare_row_condition = row_condition if not compare_row_condition else compare_row_condition -%}\n {%- set compare_group_by = group_by if not compare_group_by else compare_group_by -%}\n\n {%- set n_cols = (group_by|length) if group_by else 0 %}\n with a as (\n {{ dbt_expectations.get_select(model, expression, row_condition, group_by) }}\n ),\n b as (\n {{ dbt_expectations.get_select(compare_model, compare_expression, compare_row_condition, compare_group_by) }}\n ),\n final as (\n\n select\n {% for i in range(1, n_cols + 1) -%}\n coalesce(a.col_{{ i }}, b.col_{{ i }}) as col_{{ i }},\n {% endfor %}\n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n {% if n_cols > 0 %}\n a\n full outer join\n b on\n {% for i in range(1, n_cols + 1) -%}\n a.col_{{ i }} = b.col_{{ i }} {% if not loop.last %}and{% endif %}\n {% endfor -%}\n {% else %}\n a cross join b\n {% endif %}\n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n {% if tolerance_percent %}\n expression_difference_percent > {{ tolerance_percent }}\n {% else %}\n expression_difference > {{ tolerance }}\n {% endif %}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.get_select"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.660578}, "macro.dbt_expectations.truth_expression": {"unique_id": "macro.dbt_expectations.truth_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "name": "truth_expression", "macro_sql": "{% macro truth_expression(expression) %}\n {{ adapter.dispatch('truth_expression', 'dbt_expectations') (expression) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.661525}, "macro.dbt_expectations.default__truth_expression": {"unique_id": "macro.dbt_expectations.default__truth_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "name": "default__truth_expression", "macro_sql": "{% macro default__truth_expression(expression) %}\n {{ expression }} as expression\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.661835}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "name": "test_expect_column_values_to_match_like_pattern", "macro_sql": "{% test expect_column_values_to_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.663341}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "name": "test_expect_column_values_to_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.665953}, "macro.dbt_expectations.test_expect_column_values_to_match_regex": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "name": "test_expect_column_values_to_match_regex", "macro_sql": "{% test expect_column_values_to_match_regex(model, column_name,\n regex,\n row_condition=None\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} > 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.667583}, "macro.dbt_expectations.test_expect_column_value_lengths_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "name": "test_expect_column_value_lengths_to_equal", "macro_sql": "{% test expect_column_value_lengths_to_equal(model, column_name,\n value,\n row_condition=None\n ) %}\n\n{% set expression = dbt_utils.length(column_name) ~ \" = \" ~ value %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.length", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.669052}, "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "name": "test_expect_column_value_lengths_to_be_between", "macro_sql": "{% test expect_column_value_lengths_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\n{{ dbt_utils.length(column_name) }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.length", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.671018}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "name": "test_expect_column_values_to_not_match_regex", "macro_sql": "{% test expect_column_values_to_not_match_regex(model, column_name,\n regex,\n row_condition=None\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.672554}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "name": "test_expect_column_values_to_not_match_regex_list", "macro_sql": "{% test expect_column_values_to_not_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for regex in regex_list %}\n{{ dbt_expectations.regexp_instr(column_name, regex) }} = 0\n{%- if not loop.last %}\n{{ \" and \" if match_on == \"all\" else \" or \"}}\n{% endif -%}\n{% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.674767}, "macro.dbt_expectations.test_expect_column_values_to_match_regex_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "name": "test_expect_column_values_to_match_regex_list", "macro_sql": "{% test expect_column_values_to_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for regex in regex_list %}\n {{ dbt_expectations.regexp_instr(column_name, regex) }} > 0\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.676959}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "name": "test_expect_column_values_to_not_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6792178}, "macro.dbt_expectations._get_like_pattern_expression": {"unique_id": "macro.dbt_expectations._get_like_pattern_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "original_file_path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "name": "_get_like_pattern_expression", "macro_sql": "{% macro _get_like_pattern_expression(column_name, like_pattern, positive) %}\n{{ column_name }} {{ \"not\" if not positive else \"\" }} like '{{ like_pattern }}'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.679992}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "name": "test_expect_column_values_to_not_match_like_pattern", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.681281}, "macro.dbt_expectations.test_expect_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "name": "test_expect_row_values_to_have_recent_data", "macro_sql": "{% test expect_row_values_to_have_recent_data(model,\n column_name,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_row_values_to_have_recent_data', 'dbt_expectations') (model,\n column_name,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.683177}, "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "name": "default__test_expect_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_row_values_to_have_recent_data(model, column_name, datepart, interval, row_condition) %}\n{%- set default_start_date = '1970-01-01' -%}\nwith max_recency as (\n\n select max({{ column_name }} ) as max_date\n from\n {{ model }}\n where\n {{ column_name }} <= {{ dbt_date.today() }}\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all row, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_date, '{{ default_start_date }}')\n < {{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_date.today", "macro.dbt_utils.dateadd", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6843631}, "macro.dbt_expectations.test_expect_table_columns_to_contain_set": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_contain_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "name": "test_expect_table_columns_to_contain_set", "macro_sql": "{%- test expect_table_columns_to_contain_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n input_columns i\n left join\n relation_columns r on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n r.relation_column is null\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.687076}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "name": "test_expect_table_row_count_to_equal_other_table", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table(model, compare_model, factor=1, row_condition=None, compare_row_condition=None) -%}\n{{ dbt_expectations.test_equal_expression(model, \"count(*)\",\n compare_model=compare_model,\n compare_expression=\"count(*) * \" + factor|string,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition,\n return_difference=True\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6882071}, "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "name": "test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% test expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_grouped_row_values_to_have_recent_data', 'dbt_expectations') (model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.691775}, "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data": {"unique_id": "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "name": "default__test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) %}\nwith latest_grouped_timestamps as (\n\n select\n {%- for g in group_by %}\n {{ g }},\n {%- endfor %}\n max(1) as join_key,\n max({{ timestamp_column }}) as latest_timestamp_column\n from\n {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n {{ dbt_utils.group_by(group_by | length )}}\n\n),\ntotal_row_counts as (\n\n select\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n latest_timestamp_column < {{ dbt_utils.dateadd(datepart, interval * -1, dbt_date.now()) }}\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt_utils.dateadd", "macro.dbt_date.now"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.693419}, "macro.dbt_expectations.test_expect_column_to_exist": {"unique_id": "macro.dbt_expectations.test_expect_column_to_exist", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "original_file_path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "name": "test_expect_column_to_exist", "macro_sql": "{%- test expect_column_to_exist(model, column_name, column_index=None, transform=\"upper\") -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | map(transform) | join -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n\n {%- set matching_column_index = relation_column_names.index(column_name) if column_name in relation_column_names else -1 %}\n\n {%- if column_index -%}\n\n {%- set column_index_0 = column_index - 1 if column_index > 0 else 0 -%}\n\n {%- set column_index_matches = true if matching_column_index == column_index_0 else false %}\n\n {%- else -%}\n\n {%- set column_index_matches = true -%}\n\n {%- endif %}\n\n with test_data as (\n\n select\n cast('{{ column_name }}' as {{ dbt_utils.type_string() }}) as column_name,\n {{ matching_column_index }} as matching_column_index,\n {{ column_index_matches }} as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.69617}, "macro.dbt_expectations.test_expect_table_row_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "name": "test_expect_table_row_count_to_equal", "macro_sql": "{%- test expect_table_row_count_to_equal(model,\n value,\n group_by=None,\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_table_row_count_to_equal',\n 'dbt_expectations') (model,\n value,\n group_by,\n row_condition\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_equal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6980128}, "macro.dbt_expectations.default__test_expect_table_row_count_to_equal": {"unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "name": "default__test_expect_table_row_count_to_equal", "macro_sql": "\n\n\n\n{%- macro default__test_expect_table_row_count_to_equal(model,\n value,\n group_by,\n row_condition\n ) -%}\n{% set expression %}\ncount(*) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.6987379}, "macro.dbt_expectations.test_expect_table_row_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "name": "test_expect_table_row_count_to_be_between", "macro_sql": "{%- test expect_table_row_count_to_be_between(model,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n{% set expression %}\ncount(*)\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.700392}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor": {"unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "name": "test_expect_table_row_count_to_equal_other_table_times_factor", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table_times_factor(model, compare_model, factor, row_condition=None, compare_row_condition=None) -%}\n{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table(model, compare_model,\n factor=factor,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.701656}, "macro.dbt_expectations.test_expect_table_columns_to_match_set": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "name": "test_expect_table_columns_to_match_set", "macro_sql": "{%- test expect_table_columns_to_match_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n -- or any table column that is not in the input list\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7044249}, "macro.dbt_expectations._get_column_list": {"unique_id": "macro.dbt_expectations._get_column_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/_get_column_list.sql", "original_file_path": "macros/schema_tests/table_shape/_get_column_list.sql", "name": "_get_column_list", "macro_sql": "{%- macro _get_column_list(model, transform=\"upper\") -%}\n{%- set relation_columns = adapter.get_columns_in_relation(model) -%}\n{%- set relation_column_names = relation_columns | map(attribute=\"name\") | map(transform) | list -%}\n{%- do return(relation_column_names) -%}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.705506}, "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list": {"unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "name": "test_expect_table_columns_to_match_ordered_list", "macro_sql": "{%- test expect_table_columns_to_match_ordered_list(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select\n {{ loop.index }} as relation_column_idx,\n cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select\n {{ loop.index }} as input_column_idx,\n cast('{{ col_name }}' as {{ dbt_utils.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7091682}, "macro.dbt_expectations._list_intersect": {"unique_id": "macro.dbt_expectations._list_intersect", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/_list_intersect.sql", "original_file_path": "macros/schema_tests/table_shape/_list_intersect.sql", "name": "_list_intersect", "macro_sql": "{%- macro _list_intersect(list1, list2) -%}\n{%- set matching_items = [] -%}\n{%- for itm in list1 -%}\n {%- if itm in list2 -%}\n {%- do matching_items.append(itm) -%}\n {%- endif -%}\n{%- endfor -%}\n{%- do return(matching_items) -%}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7103732}, "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "name": "test_expect_table_column_count_to_equal_other_table", "macro_sql": "{%- test expect_table_column_count_to_equal_other_table(model, compare_model) -%}\n{%- if execute -%}\n{%- set number_columns = (adapter.get_columns_in_relation(model) | length) -%}\n{%- set compare_number_columns = (adapter.get_columns_in_relation(compare_model) | length) -%}\nwith test_data as (\n\n select\n {{ number_columns }} as number_columns,\n {{ compare_number_columns }} as compare_number_columns\n\n)\nselect *\nfrom test_data\nwhere\n number_columns != compare_number_columns\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.711618}, "macro.dbt_expectations.test_expect_table_column_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "name": "test_expect_table_column_count_to_equal", "macro_sql": "{%- test expect_table_column_count_to_equal(model, value) -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ value }} as value\n\n)\nselect *\nfrom test_data\nwhere\n number_actual_columns != value\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.712605}, "macro.dbt_expectations.test_expect_table_column_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "name": "test_expect_table_column_count_to_be_between", "macro_sql": "{%- test expect_table_column_count_to_be_between(model,\n min_value=None,\n max_value=None\n ) -%}\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\n\n{%- set expression %}\n( 1=1\n{%- if min_value %} and number_actual_columns >= min_value{% endif %}\n{%- if max_value %} and number_actual_columns <= max_value{% endif %}\n)\n{% endset -%}\n\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ min_value if min_value else 0 }} as min_value,\n {{ max_value if max_value else 0 }} as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not {{ expression }}\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.715359}, "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "name": "test_expect_column_values_to_not_be_in_set", "macro_sql": "{% test expect_column_values_to_not_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt_utils.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that match the set\n select\n v.value_field\n from\n all_values v\n join\n set_values s on v.value_field = s.value_field\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.717391}, "macro.dbt_expectations.test_expect_column_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "name": "test_expect_column_values_to_be_in_set", "macro_sql": "{% test expect_column_values_to_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt_utils.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.719438}, "macro.dbt_expectations.test_expect_column_values_to_be_increasing": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_increasing", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "name": "test_expect_column_values_to_be_increasing", "macro_sql": "{% test expect_column_values_to_be_increasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \">\" if strictly else \">=\" %}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.721154}, "macro.dbt_expectations.test_expect_column_values_to_be_null": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_null", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "name": "test_expect_column_values_to_be_null", "macro_sql": "{% test expect_column_values_to_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7223191}, "macro.dbt_expectations.test_expect_column_values_to_be_unique": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_unique", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "name": "test_expect_column_values_to_be_unique", "macro_sql": "{% test expect_column_values_to_be_unique(model, column_name, row_condition=None) %}\n{{ dbt_expectations.test_expect_compound_columns_to_be_unique(model, [column_name], row_condition=row_condition) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_compound_columns_to_be_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.723273}, "macro.dbt_expectations.test_expect_column_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "name": "test_expect_column_values_to_be_between", "macro_sql": "{% test expect_column_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ column_name }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.725019}, "macro.dbt_expectations.test_expect_column_values_to_be_decreasing": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_decreasing", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "name": "test_expect_column_values_to_be_decreasing", "macro_sql": "{% test expect_column_values_to_be_decreasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \"<\" if strictly else \"<=\" %}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over(order by sort_column) as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7269492}, "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "name": "test_expect_column_values_to_be_in_type_list", "macro_sql": "{%- test expect_column_values_to_be_in_type_list(model, column_name, column_type_list) -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | upper -%}\n {%- set columns_in_relation = adapter.get_columns_in_relation(model) -%}\n {%- set column_type_list = column_type_list| map(\"upper\") | list -%}\n with relation_columns as (\n\n {% for column in columns_in_relation %}\n select\n cast('{{ column.name | upper }}' as {{ dbt_utils.type_string() }}) as relation_column,\n cast('{{ column.dtype | upper }}' as {{ dbt_utils.type_string() }}) as relation_column_type\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = '{{ column_name }}'\n and\n relation_column_type not in ('{{ column_type_list | join(\"', '\") }}')\n\n )\n select *\n from test_data\n\n{%- endif -%}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.729943}, "macro.dbt_expectations.test_expect_column_values_to_be_of_type": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_of_type", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "name": "test_expect_column_values_to_be_of_type", "macro_sql": "{%- test expect_column_values_to_be_of_type(model, column_name, column_type) -%}\n{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(model, column_name, [column_type]) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.730654}, "macro.dbt_expectations.test_expect_column_values_to_not_be_null": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_null", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "name": "test_expect_column_values_to_not_be_null", "macro_sql": "{% test expect_column_values_to_not_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is not null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.731776}, "macro.dbt_expectations.test_expect_column_min_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_min_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "name": "test_expect_column_min_to_be_between", "macro_sql": "{% test expect_column_min_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmin({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.733545}, "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "name": "test_expect_column_unique_value_count_to_be_between", "macro_sql": "{% test expect_column_unique_value_count_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.735332}, "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "name": "test_expect_column_quantile_values_to_be_between", "macro_sql": "{% test expect_column_quantile_values_to_be_between(model, column_name,\n quantile,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.percentile_cont(column_name, quantile) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.73725}, "macro.dbt_expectations.test_expect_column_median_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_median_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "name": "test_expect_column_median_to_be_between", "macro_sql": "{% test expect_column_median_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.median(column_name) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.median", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.739084}, "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "name": "test_expect_column_proportion_of_unique_values_to_be_between", "macro_sql": "{% test expect_column_proportion_of_unique_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }})/count({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.741133}, "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "name": "test_expect_column_distinct_values_to_equal_set", "macro_sql": "{% test expect_column_distinct_values_to_equal_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as column_value\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n all_values v\n full outer join\n unique_set_values s on v.column_value = s.value_field\n where\n v.column_value is null or\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.743176}, "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "name": "test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% test expect_column_most_common_value_to_be_in_set(model, column_name,\n value_set,\n top_n,\n quote_values=False,\n data_type=\"decimal\",\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_column_most_common_value_to_be_in_set', 'dbt_expectations') (model, column_name, value_set, top_n, quote_values, data_type, row_condition) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.746057}, "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set": {"unique_id": "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "name": "default__test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% macro default__test_expect_column_most_common_value_to_be_in_set(model, column_name,\n value_set,\n top_n,\n quote_values,\n data_type,\n row_condition\n ) %}\n\nwith value_counts as (\n\n select\n {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %} as value_field,\n count(*) as value_count\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n group by {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %}\n\n),\nvalue_counts_ranked as (\n\n select\n *,\n row_number() over(order by value_count desc) as value_count_rank\n from\n value_counts\n\n),\nvalue_count_top_n as (\n\n select\n value_field\n from\n value_counts_ranked\n where\n value_count_rank = {{ top_n }}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n cast({{ value }} as {{ data_type }})\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n value_field\n from\n value_count_top_n\n where\n value_field not in (select value_field from unique_set_values)\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": 1644613438.748064}, "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "name": "test_expect_column_distinct_values_to_contain_set", "macro_sql": "{% test expect_column_distinct_values_to_contain_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values in set that are not in the list of values from the model\n select\n s.value_field\n from\n unique_set_values s\n left join\n all_values v on s.value_field = v.value_field\n where\n v.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.750143}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "name": "test_expect_column_distinct_count_to_equal", "macro_sql": "{% test expect_column_distinct_count_to_equal(model,\n column_name,\n value,\n quote_values=False,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.751631}, "macro.dbt_expectations.test_expect_column_sum_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_sum_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "name": "test_expect_column_sum_to_be_between", "macro_sql": "{% test expect_column_sum_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nsum({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.753412}, "macro.dbt_expectations.test_expect_column_stdev_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_stdev_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "name": "test_expect_column_stdev_to_be_between", "macro_sql": "{% test expect_column_stdev_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n {{ adapter.dispatch('test_expect_column_stdev_to_be_between', 'dbt_expectations') (\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_stdev_to_be_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.75595}, "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between": {"unique_id": "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "name": "default__test_expect_column_stdev_to_be_between", "macro_sql": "{% macro default__test_expect_column_stdev_to_be_between(\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) %}\n\n{% set expression %}\nstddev({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7575018}, "macro.dbt_expectations.test_expect_column_mean_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_mean_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "name": "test_expect_column_mean_to_be_between", "macro_sql": "{% test expect_column_mean_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\navg({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.759409}, "macro.dbt_expectations.test_expect_column_max_to_be_between": {"unique_id": "macro.dbt_expectations.test_expect_column_max_to_be_between", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "name": "test_expect_column_max_to_be_between", "macro_sql": "{% test expect_column_max_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmax({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.761162}, "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "name": "test_expect_column_distinct_count_to_be_greater_than", "macro_sql": "{% test expect_column_distinct_count_to_be_greater_than(model,\n column_name,\n value,\n quote_values=False,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) > {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.762683}, "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "name": "test_expect_column_distinct_values_to_be_in_set", "macro_sql": "{% test expect_column_distinct_values_to_be_in_set(model, column_name,\n value_set,\n quote_values=False,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n unique_set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.764678}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table": {"unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "name": "test_expect_column_distinct_count_to_equal_other_table", "macro_sql": "{% test expect_column_distinct_count_to_equal_other_table(model,\n compare_model,\n column_name,\n compare_column_name,\n row_condition=None,\n compare_row_condition=None\n ) %}\n{%- set expression -%}\ncount(distinct {{ column_name }})\n{%- endset -%}\n{%- set compare_expression -%}\n{%- if compare_column_name -%}\ncount(distinct {{ compare_column_name }})\n{%- else -%}\n{{ expression }}\n{%- endif -%}\n{%- endset -%}\n{{ dbt_expectations.test_equal_expression(\n model,\n expression=expression,\n compare_model=compare_model,\n compare_expression=compare_expression,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition,\n return_difference=True\n) }}\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.766577}, "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart": {"unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "original_file_path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "name": "test_expect_row_values_to_have_data_for_every_n_datepart", "macro_sql": "{%- test expect_row_values_to_have_data_for_every_n_datepart(model,\n date_col,\n date_part=\"day\",\n interval=None,\n row_condition=None,\n test_start_date=None,\n test_end_date=None) -%}\n{% if not execute %}\n {{ return('') }}\n{% endif %}\n\n{% if not test_start_date or not test_end_date %}\n {% set sql %}\n\n select\n min({{ date_col }}) as start_{{ date_part }},\n max({{ date_col }}) as end_{{ date_part }}\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n {% endset %}\n\n {%- set dr = run_query(sql) -%}\n {%- set db_start_date = dr.columns[0].values()[0].strftime('%Y-%m-%d') -%}\n {%- set db_end_date = dr.columns[1].values()[0].strftime('%Y-%m-%d') -%}\n\n{% endif %}\n\n{% if not test_start_date %}\n{% set start_date = db_start_date %}\n{% else %}\n{% set start_date = test_start_date %}\n{% endif %}\n\n\n{% if not test_end_date %}\n{% set end_date = db_end_date %}\n{% else %}\n{% set end_date = test_end_date %}\n{% endif %}\nwith base_dates as (\n\n {{ dbt_date.get_base_dates(start_date=start_date, end_date=end_date, datepart=date_part) }}\n {% if interval %}\n {# \n Filter the date spine created above down to the interval granularity using a modulo operation.\n The number of date_parts after the start_date divided by the integer interval will produce no remainder for the desired intervals, \n e.g. for 2-day interval from a starting Jan 1, 2020:\n params: start_date = '2020-01-01', date_part = 'day', interval = 2\n date spine created above: [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-04, 2020-01-05, ...]\n The first parameter to the `mod` function would be the number of days between the start_date and the spine date, i.e. [0, 1, 2, 3, 4 ...]\n The second parameter to the `mod` function would be the integer interval, i.e. 2\n This modulo operation produces the following remainders: [0, 1, 0, 1, 0, ...]\n Filtering the spine only where this remainder == 0 will return a spine with every other day as desired, i.e. [2020-01-01, 2020-01-03, 2020-01-05, ...]\n #}\n where mod(\n cast({{ dbt_utils.datediff(\"'\" ~ start_date ~ \"'\", 'date_' ~ date_part, date_part) }} as {{ dbt_utils.type_int() }}),\n cast({{interval}} as {{ dbt_utils.type_int() }})\n ) = 0\n {% endif %}\n\n),\nmodel_data as (\n\n select\n {% if not interval %}\n\n cast({{ dbt_utils.date_trunc(date_part, date_col) }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n\n {% else %}\n {# \n Use a modulo operator to determine the number of intervals that a date_col is away from the interval-date spine \n and subtracts that amount to effectively slice each date_col record into its corresponding spine bucket,\n e.g. given a date_col of with records [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-11, 2020-01-12]\n if we want to slice these dates into their 2-day buckets starting Jan 1, 2020 (start_date = '2020-01-01', date_part='day', interval=2),\n the modulo operation described above will produce these remainders: [0, 1, 0, 0, 1]\n subtracting that number of days from the observations will produce records [2020-01-01, 2020-01-01, 2020-01-03, 2020-01-11, 2020-01-11],\n all of which align with records from the interval-date spine\n #}\n {{dbt_utils.dateadd(\n date_part, \n \"mod(\n cast(\" ~ dbt_utils.datediff(\"'\" ~ start_date ~ \"'\", date_col, date_part) ~ \" as \" ~ dbt_utils.type_int() ~ \" ),\n cast(\" ~ interval ~ \" as \" ~ dbt_utils.type_int() ~ \" )\n ) * (-1)\", \n \"cast( \" ~ dbt_utils.date_trunc(date_part, date_col) ~ \" as \" ~ dbt_expectations.type_datetime() ~ \")\"\n )}} as date_{{ date_part }},\n \n {% endif %}\n \n count(*) as row_cnt\n from\n {{ model }} f\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n group by\n date_{{date_part}}\n\n),\n\nfinal as (\n\n select\n cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n case when f.date_{{ date_part }} is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) = f.date_{{ date_part }}\n\n)\nselect\n *\nfrom final\nwhere\n row_cnt = 0\n{%- endtest -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt_date.get_base_dates", "macro.dbt_utils.datediff", "macro.dbt_utils.type_int", "macro.dbt_utils.date_trunc", "macro.dbt_expectations.type_datetime", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.776594}, "macro.dbt_expectations._get_metric_expression": {"unique_id": "macro.dbt_expectations._get_metric_expression", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "_get_metric_expression", "macro_sql": "{%- macro _get_metric_expression(metric_column, take_logs) -%}\n\n{%- if take_logs %}\n{%- set expr = \"nullif(\" ~ metric_column ~ \", 0)\" -%}\ncoalesce({{ dbt_expectations.log_natural(expr) }}, 0)\n{%- else -%}\ncoalesce({{ metric_column }}, 0)\n{%- endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.log_natural"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.782503}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n period='day',\n lookback_periods=1,\n trend_periods=7,\n test_periods=14,\n sigma_threshold=3,\n sigma_threshold_upper=None,\n sigma_threshold_lower=None,\n take_diffs=true,\n take_logs=true\n ) -%}\n {{ adapter.dispatch('test_expect_column_values_to_be_within_n_moving_stdevs', 'dbt_expectations') (model,\n column_name,\n date_column_name,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.783807}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs": {"unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "name": "default__test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) %}\n\n{%- set sigma_threshold_upper = sigma_threshold_upper if sigma_threshold_upper else sigma_threshold -%}\n{%- set sigma_threshold_lower = sigma_threshold_lower if sigma_threshold_lower else -1 * sigma_threshold -%}\n\nwith metric_values as (\n\n with grouped_metric_values as (\n\n select\n {{ dbt_utils.date_trunc(period, date_column_name) }} as metric_period,\n sum({{ column_name }}) as agg_metric_value\n from\n {{ model }}\n group by\n 1\n\n ),\n {%- if take_diffs %}\n grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, {{ lookback_periods }}) over(order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n -\n {{ dbt_expectations._get_metric_expression(\"prior_agg_metric_value\", take_logs) }}\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n {%- else %}\n\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n from\n grouped_metric_values\n\n {%- endif %}\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over(order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over(order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n {{ dbt_utils.dateadd(period, -test_periods, dbt_utils.date_trunc(period, dbt_date.now())) }}\n as {{ dbt_utils.type_timestamp() }})\n and\n metric_period < {{ dbt_utils.date_trunc(period, dbt_date.now()) }}\n and\n\n not (\n metric_test_sigma >= {{ sigma_threshold_lower }} and\n metric_test_sigma <= {{ sigma_threshold_upper }}\n )\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.dbt_expectations._get_metric_expression", "macro.dbt_utils.dateadd", "macro.dbt_date.now", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.786572}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs": {"unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "name": "test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by=None,\n sigma_threshold=3\n ) -%}\n {{ adapter.dispatch('test_expect_column_values_to_be_within_n_stdevs', 'dbt_expectations') (model, column_name, group_by, sigma_threshold) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.788369}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs": {"unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "name": "default__test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by,\n sigma_threshold\n ) %}\nwith metric_values as (\n\n {% if group_by -%}\n select\n {{ group_by }} as metric_date,\n sum({{ column_name }}) as {{ column_name }}\n from\n {{ model }}\n group by\n 1\n {%- else -%}\n select\n {{ column_name }} as {{ column_name }}\n from\n {{ model }}\n {%- endif %}\n\n),\nmetric_values_with_statistics as (\n\n select\n *,\n avg({{ column_name }}) over() as {{ column_name }}_average,\n stddev({{ column_name }}) over() as {{ column_name }}_stddev\n from\n metric_values\n\n),\nmetric_values_z_scores as (\n\n select\n *,\n ({{ column_name }} - {{ column_name }}_average)/{{ column_name }}_stddev as {{ column_name }}_sigma\n from\n metric_values_with_statistics\n\n)\nselect\n *\nfrom\n metric_values_z_scores\nwhere\n abs({{ column_name }}_sigma) > {{ sigma_threshold }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.7897532}, "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record": {"unique_id": "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "name": "test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% test expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_select_column_values_to_be_unique_within_record', 'dbt_expectations') (model, column_list, quote_columns, ignore_row_if, row_condition) }}\n{%- endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.792993}, "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record": {"unique_id": "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "name": "default__test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% macro default__test_expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns,\n ignore_row_if,\n row_condition\n ) %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.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_columns ~\"'.'\"\n ) }}\n{% endif %}\n\nwith column_values as (\n\n select\n row_number() over(order by 1) as row_index,\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n from {{ model }}\n where 1=1\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n {% if ignore_row_if == \"all_values_are_missing\" %}\n and\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} and {% endif %}\n {%- endfor %}\n )\n {% elif ignore_row_if == \"any_value_is_missing\" %}\n and\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} or {% endif %}\n {%- endfor %}\n )\n {% endif %}\n\n),\nunpivot_columns as (\n\n {% for column in columns %}\n select row_index, '{{ column }}' as column_name, {{ column }} as column_value from column_values\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n\n select\n row_index,\n count(distinct column_value) as column_values\n from unpivot_columns\n group by 1\n having count(distinct column_value) < {{ columns | length }}\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": 1644613438.79654}, "macro.dbt_expectations.test_expect_compound_columns_to_be_unique": {"unique_id": "macro.dbt_expectations.test_expect_compound_columns_to_be_unique", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "original_file_path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "name": "test_expect_compound_columns_to_be_unique", "macro_sql": "{% test expect_compound_columns_to_be_unique(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for expect_compound_columns_to_be_unique test must be one of [True, False] Got: '\" ~ quote_columns ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set row_condition_ext %}\n\n{% if row_condition %}\n {{ row_condition }} and\n{% endif %}\n\n{% if ignore_row_if == \"all_values_are_missing\" %}\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} and {% endif %}\n {%- endfor %}\n )\n{% elif ignore_row_if == \"any_value_is_missing\" %}\n (\n {% for column in columns -%}\n {{ column }} is not null{% if not loop.last %} or {% endif %}\n {%- endfor %}\n )\n{% endif %}\n{% endset %}\n\nwith validation_errors as (\n\n select\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n from {{ model }}\n where 1=1\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n group by\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n having count(*) > 1\n\n)\nselect * from validation_errors\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.8018959}, "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal": {"unique_id": "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "name": "test_expect_multicolumn_sum_to_equal", "macro_sql": "{% test expect_multicolumn_sum_to_equal(model,\n column_list,\n sum_total,\n group_by=None,\n row_condition=None\n ) %}\n\n{% set operator = \"=\" %}\n{% set expression %}\n{% for column in column_list %}\nsum({{ column }}){% if not loop.last %} + {% endif %}\n{% endfor %} = {{ sum_total }}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.804044}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "name": "test_expect_column_pair_values_to_be_equal", "macro_sql": "{% test expect_column_pair_values_to_be_equal(model,\n column_A,\n column_B,\n row_condition=None\n ) %}\n\n{% set operator = \"=\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.8057542}, "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "name": "test_expect_column_pair_values_A_to_be_greater_than_B", "macro_sql": "{% test expect_column_pair_values_A_to_be_greater_than_B(model,\n column_A,\n column_B,\n or_equal=False,\n row_condition=None\n ) %}\n\n{% set operator = \">=\" if or_equal else \">\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.8077838}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set": {"unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set", "package_name": "dbt_expectations", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "name": "test_expect_column_pair_values_to_be_in_set", "macro_sql": "{% test expect_column_pair_values_to_be_in_set(model,\n column_A,\n column_B,\n value_pairs_set,\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for pair in value_pairs_set %}\n{%- if (pair | length) == 2 %}\n({{ column_A }} = {{ pair[0] }} and {{ column_B }} = {{ pair[1] }}){% if not loop.last %} or {% endif %}\n{% else %}\n{{ exceptions.raise_compiler_error(\n \"`value_pairs_set` argument for expect_column_pair_values_to_be_in_set test cannot have more than 2 item per element.\n Got: '\" ~ pair ~ \"'.'\"\n ) }}\n{% endif %}\n{% endfor %}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644613438.810702}}, "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 `--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"}, "google_ads_source._fivetran_id": {"unique_id": "google_ads_source._fivetran_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "_fivetran_id", "block_contents": "Unique ID used by Fivetran to sync and dedupe data."}, "google_ads_source._fivetran_synced": {"unique_id": "google_ads_source._fivetran_synced", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "_fivetran_synced", "block_contents": "Timestamp of when a record was last synced."}, "google_ads_source.account_descriptive_name": {"unique_id": "google_ads_source.account_descriptive_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "account_descriptive_name", "block_contents": "The descriptive name of the Customer account."}, "google_ads_source.ad_group_id": {"unique_id": "google_ads_source.ad_group_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_id", "block_contents": "The ID of the AdGroup."}, "google_ads_source.ad_group_name": {"unique_id": "google_ads_source.ad_group_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_name", "block_contents": "The name of the AdGroup."}, "google_ads_source.ad_group_status": {"unique_id": "google_ads_source.ad_group_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_status", "block_contents": "Status of the ad group."}, "google_ads_source.campaign_id": {"unique_id": "google_ads_source.campaign_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_id", "block_contents": "The ID of the Campaign."}, "google_ads_source.ad_id": {"unique_id": "google_ads_source.ad_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_id", "block_contents": "The ID of the Ad."}, "google_ads_source.account_id": {"unique_id": "google_ads_source.account_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "account_id", "block_contents": "The ID of the Account."}, "google_ads_source.ad_status": {"unique_id": "google_ads_source.ad_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_status", "block_contents": "Status of the Ad."}, "google_ads_source.campaign_name": {"unique_id": "google_ads_source.campaign_name", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_name", "block_contents": "The name of the Campaign."}, "google_ads_source.campaign_status": {"unique_id": "google_ads_source.campaign_status", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "campaign_status", "block_contents": "Status of the Campaign."}, "google_ads_source.clicks": {"unique_id": "google_ads_source.clicks", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "clicks", "block_contents": "The number of clicks."}, "google_ads_source.cost": {"unique_id": "google_ads_source.cost", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "cost", "block_contents": "The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period."}, "google_ads_source.date": {"unique_id": "google_ads_source.date", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "date", "block_contents": "The date being reported on."}, "google_ads_source.effective_final_url": {"unique_id": "google_ads_source.effective_final_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "effective_final_url", "block_contents": "Effective final URL of the impressions."}, "google_ads_source.external_customer_id": {"unique_id": "google_ads_source.external_customer_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "external_customer_id", "block_contents": "The Customer ID."}, "google_ads_source.impressions": {"unique_id": "google_ads_source.impressions", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "impressions", "block_contents": "Count of how often your ad has appeared on a search results page or website on the Google Network."}, "google_ads_source.criteria_id": {"unique_id": "google_ads_source.criteria_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_id", "block_contents": "The Criterion ID."}, "google_ads_source.gcl_id": {"unique_id": "google_ads_source.gcl_id", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "gcl_id", "block_contents": "The Google Click ID."}, "google_ads_source.criteria": {"unique_id": "google_ads_source.criteria", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria", "block_contents": "Descriptive string for the Criterion."}, "google_ads_source.criteria_destination_url": {"unique_id": "google_ads_source.criteria_destination_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_destination_url", "block_contents": "Destination URL of the criterion that triggered ads."}, "google_ads_source.criteria_type": {"unique_id": "google_ads_source.criteria_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "criteria_type", "block_contents": "The type of the Criterion."}, "google_ads_source.base_url": {"unique_id": "google_ads_source.base_url", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "base_url", "block_contents": "The base URL of the ad, extracted from the `effective_final_url`."}, "google_ads_source.url_host": {"unique_id": "google_ads_source.url_host", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "url_host", "block_contents": "The URL host of the ad, extracted from the `effective_final_url`."}, "google_ads_source.url_path": {"unique_id": "google_ads_source.url_path", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "url_path", "block_contents": "The URL path of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_source": {"unique_id": "google_ads_source.utm_source", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_source", "block_contents": "The utm_source parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_medium": {"unique_id": "google_ads_source.utm_medium", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_medium", "block_contents": "The utm_medium parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_campaign": {"unique_id": "google_ads_source.utm_campaign", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_campaign", "block_contents": "The utm_campaign parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_content": {"unique_id": "google_ads_source.utm_content", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_content", "block_contents": "The utm_content parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.utm_term": {"unique_id": "google_ads_source.utm_term", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "utm_term", "block_contents": "The utm_term parameter of the ad, extracted from the `effective_final_url`."}, "google_ads_source.updated_at": {"unique_id": "google_ads_source.updated_at", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "updated_at", "block_contents": "Timestamp of when the record was last updated in Google Ads."}, "google_ads_source.ad_type": {"unique_id": "google_ads_source.ad_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_type", "block_contents": "The type of the ad in Google Ads."}, "google_ads_source.ad_group_type": {"unique_id": "google_ads_source.ad_group_type", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "ad_group_type", "block_contents": "The type of the ad group in Google Ads."}, "google_ads_source.is_most_recent_record": {"unique_id": "google_ads_source.is_most_recent_record", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "docs.md", "original_file_path": "models/docs.md", "name": "is_most_recent_record", "block_contents": "Boolean representing whether the record is the most recent version of the object."}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {"model.google_ads_source.stg_google_ads__final_url_performance": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__final_url_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__final_url_performance_tmp')),\n staging_columns=get_final_url_performance_columns()\n )\n }}\n\n {% for metric in var('google_ads__url_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n\n from source\n\n), \n\nurl_fields as (\n\n select\n *,\n {{ dbt_utils.split_part('final_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('final_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path,\n\n {% if var('google_auto_tagging_enabled', false) %}\n\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} , 'google') as utm_source,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} , 'cpc') as utm_medium,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} , campaign_name) as utm_campaign,\n coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} , ad_group_name) as utm_content,\n\n {% else %}\n\n {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content,\n \n {% endif %}\n \n {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term\n\n from renamed\n\n), surrogate_key as (\n\n select\n *,\n {{ dbt_utils.surrogate_key(['date_day','campaign_id','ad_group_id','final_url']) }} as final_url_performance_id\n from url_fields\n\n)\n\nselect * from surrogate_key", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_final_url_performance_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter", "macro.dbt_utils.surrogate_key"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__final_url_performance"], "unique_id": "model.google_ads_source.stg_google_ads__final_url_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__final_url_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__final_url_performance.sql", "name": "stg_google_ads__final_url_performance", "alias": "stg_google_ads__final_url_performance", "checksum": {"name": "sha256", "checksum": "c355bede9303daf44f6b4336717c4cc1123d9dc1421ebe262b2328fada9227ef"}, "tags": [], "refs": [["stg_google_ads__final_url_performance_tmp"], ["stg_google_ads__final_url_performance_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": false}, "created_at": 1644613439.919051}], "model.google_ads_source.stg_google_ads__criteria_performance": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__criteria_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__criteria_performance_tmp')),\n staging_columns=get_criteria_performance_columns()\n )\n }}\n\n {% for metric in var('google_ads__criteria_passthrough_metrics') %}\n , {{ metric }}\n {% endfor %}\n\n from source\n\n)\n\nselect * from renamed", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_criteria_performance_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__criteria_performance"], "unique_id": "model.google_ads_source.stg_google_ads__criteria_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__criteria_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__criteria_performance.sql", "name": "stg_google_ads__criteria_performance", "alias": "stg_google_ads__criteria_performance", "checksum": {"name": "sha256", "checksum": "ab4b1625b4bd0e83fe246493b59d7f5855a010df54504af9bba18bf7235885b8"}, "tags": [], "refs": [["stg_google_ads__criteria_performance_tmp"], ["stg_google_ads__criteria_performance_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": false}, "created_at": 1644613439.9693902}], "model.google_ads_source.stg_google_ads__click_performance": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nwith source as (\n\n select *\n from {{ ref('stg_google_ads__click_performance_tmp') }}\n\n),\n\nrenamed as (\n\n select\n \n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__click_performance_tmp')),\n staging_columns=get_click_performance_columns()\n )\n }}\n\n from source\n\n)\n\nselect * from renamed", "resource_type": "model", "depends_on": {"macros": ["macro.google_ads_source.get_click_performance_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "stg_google_ads__click_performance"], "unique_id": "model.google_ads_source.stg_google_ads__click_performance", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/stg_google_ads__click_performance.sql", "original_file_path": "models/adwords_connector/stg_google_ads__click_performance.sql", "name": "stg_google_ads__click_performance", "alias": "stg_google_ads__click_performance", "checksum": {"name": "sha256", "checksum": "6156e79e5cc8fbb4f7800c52d2cbfc93630675f744c3a87a35c7a9c0e24cdf6d"}, "tags": [], "refs": [["stg_google_ads__click_performance_tmp"], ["stg_google_ads__click_performance_tmp"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": "google_ads_source://models/adwords_connector/stg_google_ads.yml", "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "table", "enabled": false}, "created_at": 1644613439.9930298}], "model.google_ads_source.stg_google_ads__criteria_performance_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__criteria_performance') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__criteria_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__criteria_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql", "name": "stg_google_ads__criteria_performance_tmp", "alias": "stg_google_ads__criteria_performance_tmp", "checksum": {"name": "sha256", "checksum": "4b602c50e2569f30109a5e00524b941d9f9aa74e7f2e6afb851c9e97aa6ca0be"}, "tags": [], "refs": [], "sources": [["adwords", "criteria_performance"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": false}, "created_at": 1644613440.0155299}], "model.google_ads_source.stg_google_ads__final_url_performance_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__final_url_performance') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__final_url_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__final_url_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql", "name": "stg_google_ads__final_url_performance_tmp", "alias": "stg_google_ads__final_url_performance_tmp", "checksum": {"name": "sha256", "checksum": "4e029c606fcb0642ae29d6ae9add21c37eaf3ba2a3275e1c1bdda62113ea3232"}, "tags": [], "refs": [], "sources": [["adwords", "final_url_performance"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": false}, "created_at": 1644613440.02338}], "model.google_ads_source.stg_google_ads__click_performance_tmp": [{"raw_sql": "{{ config(enabled=var('api_source') == 'adwords') }}\n\nselect *\nfrom {{ var('google_ads__click_performance') }}", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": "google_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "bigquery-db", "schema": "dbt_joe_google_ads", "fqn": ["google_ads_source", "adwords_connector", "tmp", "stg_google_ads__click_performance_tmp"], "unique_id": "model.google_ads_source.stg_google_ads__click_performance_tmp", "package_name": "google_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/GoogleAds/development/dbt_packages/google_ads_source", "path": "adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql", "original_file_path": "models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql", "name": "stg_google_ads__click_performance_tmp", "alias": "stg_google_ads__click_performance_tmp", "checksum": {"name": "sha256", "checksum": "406f0453e172f001316df965f60044079475b8c05b482d8aefbcc4aa1d57949a"}, "tags": [], "refs": [], "sources": [["adwords", "click_performance"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "google_ads", "materialized": "view", "enabled": false}, "created_at": 1644613440.0315552}]}, "parent_map": {"test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": [], "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": [], "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": [], "model.google_ads_source.stg_google_ads__ad_stats": ["model.google_ads_source.stg_google_ads__ad_stats_tmp", "model.google_ads_source.stg_google_ads__ad_stats_tmp"], "model.google_ads_source.stg_google_ads__ad_stats_tmp": ["source.google_ads_source.adwords.ad_stats"], "model.google_ads_source.stg_google_ads__ad_history_tmp": ["source.google_ads_source.adwords.ad_history"], "model.google_ads_source.stg_google_ads__ad_group_history": ["model.google_ads_source.stg_google_ads__ad_group_history_tmp", "model.google_ads_source.stg_google_ads__ad_group_history_tmp"], "model.google_ads_source.stg_google_ads__ad_group_history_tmp": ["source.google_ads_source.adwords.ad_group_history"], "model.google_ads_source.stg_google_ads__campaign_history": ["model.google_ads_source.stg_google_ads__campaign_history_tmp", "model.google_ads_source.stg_google_ads__campaign_history_tmp"], "model.google_ads_source.stg_google_ads__campaign_history_tmp": ["source.google_ads_source.adwords.campaign_history"], "model.google_ads_source.stg_google_ads__account_history": ["model.google_ads_source.stg_google_ads__account_history_tmp", "model.google_ads_source.stg_google_ads__account_history_tmp"], "model.google_ads_source.stg_google_ads__account_history_tmp": ["source.google_ads_source.adwords.account_history"], "test.google_ads_source.dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___.353402b689": ["source.google_ads_source.adwords.ad_history"], "model.google_ads_source.stg_google_ads__ad_history": ["model.google_ads_source.stg_google_ads__ad_history_tmp", "model.google_ads_source.stg_google_ads__ad_history_tmp"], "source.google_ads_source.adwords.ad_stats": [], "source.google_ads_source.adwords.ad_history": [], "source.google_ads_source.adwords.ad_group_history": [], "source.google_ads_source.adwords.campaign_history": [], "source.google_ads_source.adwords.account_history": [], "source.google_ads_source.adwords.final_url_performance": [], "source.google_ads_source.adwords.click_performance": [], "source.google_ads_source.adwords.criteria_performance": []}, "child_map": {"test.google_ads_source.not_null_stg_google_ads__click_performance_gclid.7552ea9f1f": [], "test.google_ads_source.unique_stg_google_ads__final_url_performance_final_url_performance_id.529a5342d9": [], "test.google_ads_source.not_null_stg_google_ads__final_url_performance_final_url_performance_id.70e3b81ecb": [], "model.google_ads_source.stg_google_ads__ad_stats": [], "model.google_ads_source.stg_google_ads__ad_stats_tmp": ["model.google_ads_source.stg_google_ads__ad_stats", "model.google_ads_source.stg_google_ads__ad_stats"], "model.google_ads_source.stg_google_ads__ad_history_tmp": ["model.google_ads_source.stg_google_ads__ad_history", "model.google_ads_source.stg_google_ads__ad_history"], "model.google_ads_source.stg_google_ads__ad_group_history": [], "model.google_ads_source.stg_google_ads__ad_group_history_tmp": ["model.google_ads_source.stg_google_ads__ad_group_history", "model.google_ads_source.stg_google_ads__ad_group_history"], "model.google_ads_source.stg_google_ads__campaign_history": [], "model.google_ads_source.stg_google_ads__campaign_history_tmp": ["model.google_ads_source.stg_google_ads__campaign_history", "model.google_ads_source.stg_google_ads__campaign_history"], "model.google_ads_source.stg_google_ads__account_history": [], "model.google_ads_source.stg_google_ads__account_history_tmp": ["model.google_ads_source.stg_google_ads__account_history", "model.google_ads_source.stg_google_ads__account_history"], "test.google_ads_source.dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___.353402b689": [], "model.google_ads_source.stg_google_ads__ad_history": [], "source.google_ads_source.adwords.ad_stats": ["model.google_ads_source.stg_google_ads__ad_stats_tmp"], "source.google_ads_source.adwords.ad_history": ["model.google_ads_source.stg_google_ads__ad_history_tmp", "test.google_ads_source.dbt_expectations_source_expect_column_values_to_not_match_regex_list_adwords_ad_history_final_urls__any___.353402b689"], "source.google_ads_source.adwords.ad_group_history": ["model.google_ads_source.stg_google_ads__ad_group_history_tmp"], "source.google_ads_source.adwords.campaign_history": ["model.google_ads_source.stg_google_ads__campaign_history_tmp"], "source.google_ads_source.adwords.account_history": ["model.google_ads_source.stg_google_ads__account_history_tmp"], "source.google_ads_source.adwords.final_url_performance": [], "source.google_ads_source.adwords.click_performance": [], "source.google_ads_source.adwords.criteria_performance": []}} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/ci/sample.profiles.yml b/dbt_packages/google_ads_source/integration_tests/ci/sample.profiles.yml new file mode 100644 index 0000000..e992ab7 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/ci/sample.profiles.yml @@ -0,0 +1,60 @@ + +# HEY! This file is used in the Google Ads integrations tests with CircleCI. +# You should __NEVER__ check credentials into version control. Thanks for reading :) + +config: + send_anonymous_usage_stats: False + use_colors: True + +integration_tests: + target: snowflake + outputs: + redshift: + type: redshift + host: "{{ env_var('CI_REDSHIFT_DBT_HOST') }}" + user: "{{ env_var('CI_REDSHIFT_DBT_USER') }}" + pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}" + dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}" + port: 5439 + schema: google_ads_source_integration_tests + threads: 8 + bigquery: + type: bigquery + method: service-account + keyfile: "{{ env_var('GCLOUD_SERVICE_KEY_PATH') }}" + project: 'dbt-package-testing' + schema: google_ads_source_integration_tests + threads: 8 + snowflake: + type: snowflake + account: "{{ env_var('CI_SNOWFLAKE_DBT_ACCOUNT') }}" + user: "{{ env_var('CI_SNOWFLAKE_DBT_USER') }}" + password: "{{ env_var('CI_SNOWFLAKE_DBT_PASS') }}" + role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}" + database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}" + warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}" + schema: google_ads_source_integration_tests + threads: 8 + spark: + type: spark + method: http + schema: google_ads_source_integration_tests + host: "{{ env_var('CI_SPARK_DBT_HOST') }}" + organization: "{{ env_var('CI_SPARK_DBT_ORGANIZATION') }}" + token: "{{ env_var('CI_SPARK_DBT_TOKEN') }}" + cluster: "{{ env_var('CI_SPARK_DBT_CLUSTER') }}" + port: 443 + connect_timeout: 60 + connect_retries: 5 + threads: 4 + postgres: + type: postgres + host: "{{ env_var('CI_POSTGRES_DBT_HOST') }}" + user: "{{ env_var('CI_POSTGRES_DBT_USER') }}" + password: "{{ env_var('CI_POSTGRES_DBT_PASS') }}" + port: 5432 + dbname: "{{ env_var('CI_POSTGRES_DBT_DATABASE') }}" + schema: google_ads_source_integration_tests + threads: 8 + keepalives_idle: 0 + sslmode: prefer \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/dbt_project.yml b/dbt_packages/google_ads_source/integration_tests/dbt_project.yml new file mode 100644 index 0000000..abd54a5 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/dbt_project.yml @@ -0,0 +1,58 @@ +name: 'google_ads_source_integration_tests' +version: '0.7.0' +profile: 'integration_tests' +config-version: 2 + +vars: + google_ads__final_url_performance: "{{ ref('google_ads_final_url_performance_data') }}" + google_ads__click_performance: "{{ ref('google_ads_click_performance_data') }}" + google_ads__criteria_performance: "{{ ref('google_ads_criteria_performance_data') }}" + google_ads__ad_stats: "{{ ref('google_ads_ad_stats_data') }}" + google_ads__ad_history: "{{ ref('google_ads_ad_history_data') }}" + google_ads__ad_group_history: "{{ ref('google_ads_ad_group_history_data') }}" + google_ads__campaign_history: "{{ ref('google_ads_campaign_history_data') }}" + google_ads__account_history: "{{ ref('google_ads_account_history_data') }}" + +seeds: + google_ads_source_integration_tests: + google_ads_click_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + criteria_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_criteria_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_final_url_performance_data: + +column_types: + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + external_customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_stats_data: + +column_types: + customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + ad_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_campaign_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + customer_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_group_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + base_campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + google_ads_ad_history_data: + +column_types: + id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}" + +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] diff --git a/dbt_packages/google_ads_source/integration_tests/packages.yml b/dbt_packages/google_ads_source/integration_tests/packages.yml new file mode 100644 index 0000000..b16d307 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/packages.yml @@ -0,0 +1,2 @@ +packages: + - local: ../ \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/requirements.txt b/dbt_packages/google_ads_source/integration_tests/requirements.txt new file mode 100644 index 0000000..5c612de --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/requirements.txt @@ -0,0 +1,6 @@ +dbt-snowflake~=1.0.0 +dbt-bigquery~=1.0.0 +dbt-redshift~=1.0.0 +dbt-postgres~=1.0.0 +dbt-spark~=1.0.0 +dbt-spark[PyHive]~=1.0.0 \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_account_history_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_account_history_data.csv new file mode 100644 index 0000000..e299c9b --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_account_history_data.csv @@ -0,0 +1,2 @@ +id,updated_at,_fivetran_synced,auto_tagging_enabled,currency_code,descriptive_name,final_url_suffix,hidden,manager,manager_customer_id,optimization_score,pay_per_conversion_eligibility_failure_reasons,test_account,time_zone,tracking_url_template +2121450128,2022-02-01 2:20:51,2022-02-01 2:20:52,TRUE,USD,,FALSE,FALSE,,0.5,[],FALSE,America/Los_Angeles,, \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_group_history_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_group_history_data.csv new file mode 100644 index 0000000..38f8bff --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_group_history_data.csv @@ -0,0 +1,101 @@ +id,updated_at,_fivetran_synced,ad_group_rotation_mode,type,base_ad_group_id,base_campaign_id,bidding_strategy_bid_ceiling,bidding_strategy_bid_changes_for_raises_only,bidding_strategy_bid_floor,bidding_strategy_bid_modifier,bidding_strategy_competitor_domain,bidding_strategy_cpa_bid_amount,bidding_strategy_cpc_bid_amount,bidding_strategy_cpm_bid_amount,bidding_strategy_enhanced_cpc_enabled,bidding_strategy_id,bidding_strategy_max_cpc_bid_ceiling,bidding_strategy_max_cpc_bid_floor,bidding_strategy_name,bidding_strategy_raise_bid_when_budget_constrained,bidding_strategy_raise_bid_when_low_quality_score,bidding_strategy_scheme_type,bidding_strategy_source,bidding_strategy_spend_target,bidding_strategy_strategy_goal,bidding_strategy_target_cpa,bidding_strategy_target_outrank_share,bidding_strategy_target_roas,bidding_strategy_target_roas_override,bidding_strategy_type,bidding_strategy_viewable_cpm_enabled,campaign_id,content_bid_criterion_type_group,final_url_suffix,status,tracking_url_template,campaign_name,name +19495104253,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104253,286221013,,,,,,,7160000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221013,UNSPECIFIED,,ENABLED,,oVFgipETrMywnJ6/ewsrag==,oVFgipETrMywnJ6/ewsrag== +19495104973,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104973,286221373,,,,,,,30000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221373,UNSPECIFIED,,ENABLED,,ZpgkqBWjbLa9WhhuMSNi0A==,ZpgkqBWjbLa9WhhuMSNi0A== +19495104613,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19495104613,286221133,,,,,,,9160000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286221133,UNSPECIFIED,,ENABLED,,HYsgTGpx5xAPChknrmbp8A==,HYsgTGpx5xAPChknrmbp8A== +19494891733,2021-08-25T20:21:09.602,2021-08-25T20:21:15.313,UNSPECIFIED,SEARCH_STANDARD,19494891733,286213813,,,,,,,5880000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,286213813,UNSPECIFIED,,ENABLED,,Sm27L/ZQ+Cr4AfccPv1yww==,Sm27L/ZQ+Cr4AfccPv1yww== +123130088562,2021-08-23T12:58:42,2021-08-26T02:22:52.410,UNSPECIFIED,SEARCH_STANDARD,123130088562,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,dS2l8GFXdXV2fMnw/4M8cA== +123130088522,2021-08-23T12:58:42,2021-08-26T02:22:52.410,ROTATE_FOREVER,SEARCH_STANDARD,123130088522,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,p/jOB+IWVWqZnVKrfwZZSA== +123130088762,2021-08-23T12:58:42,2021-08-26T02:22:52.410,UNSPECIFIED,SEARCH_STANDARD,123130088762,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,ACYseD+ArWvEkQLMRU866Q== +121614771753,2021-09-02T16:50:15,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771753,2021-09-15T18:19:23,2021-09-16T02:21:55.297,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771753,2021-09-14T17:02:32,2021-09-15T02:23:03.112,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121614771793,2021-09-02T16:50:14,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,121614771793,12649004531,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004531,UNSPECIFIED,,ENABLED,,5+E5FkXEIUbqRD8dsxqMnA==,GRLUBqIoAZoFVot+4MyrEw== +119807941826,2021-09-02T16:50:15,2021-09-03T02:22:35.597,UNSPECIFIED,DISPLAY_STANDARD,119807941826,12661488925,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12661488925,UNSPECIFIED,,ENABLED,,bamZHp8M//g/wZkn+vEcMg==,aOgzIZFTjWFu6C7ts/H6Cw== +127258434700,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,ENABLED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434700,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,PAUSED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434700,2021-08-27T14:26:05,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434700,14431483159,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483159,UNSPECIFIED,,ENABLED,,h36RDBa7OWEQEATsU0d+VA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,PAUSED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,ENABLED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434860,2021-08-27T14:28:04,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434860,14431483162,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483162,UNSPECIFIED,,ENABLED,,KZat90m2bJsEs4edZm7IkA==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-08-27T14:29:24,2021-08-28T02:23:40.094,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,ENABLED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-08-27T13:07:44,2021-08-27T20:21:45.699,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,PAUSED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +127258434900,2021-09-02T16:50:15,2021-09-03T02:22:35.598,UNSPECIFIED,DISPLAY_STANDARD,127258434900,14431483165,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14431483165,UNSPECIFIED,,ENABLED,,gpKYFsIkCrKv32B0GZEvhQ==,nM9M7JG2NitQvdvzSUK4tQ== +78990169090,2021-08-25T20:21:09.602,2021-08-25T20:21:15.317,UNSPECIFIED,DISPLAY_STANDARD,78990169090,8106652778,,,,,,,2000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,8106652778,UNSPECIFIED,,ENABLED,,XHBL7S0hRe9ED3Wlg+P7rg==,Xglfg5UzHVr7LcqmHRG0dA== +57498468408,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57498468408,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,wG1LLw2nfQm4J7jB7nzB1g== +52792597675,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,52792597675,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,p/jOB+IWVWqZnVKrfwZZSA== +53082413518,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,53082413518,343273453,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273453,UNSPECIFIED,,PAUSED,,A2XSudLygSmM9hLwtKobbw==,AllP3uWEv05eGD1PbAvi9g== +57782427513,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,OPTIMIZE,DISPLAY_STANDARD,57782427513,1438324780,,,,,,,250000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1438324780,UNSPECIFIED,,ENABLED,,7rKssxier5+GtrCeJEoo+A==,XnXu96kJozWIB1kDLur1CA== +54087239006,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,54087239006,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,bWDYY4R5YY4hFNN6e+cmyg== +55991028475,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,55991028475,1399909916,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,bYq4SJQTdWsa9r2ra4CGPg== +52024440901,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,52024440901,1399909916,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,dPXQ0CAUvqTBp9uObhYTaA== +57782826160,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57782826160,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,OchM9hPHDjfBHG/+BuTFmw== +58896448727,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,58896448727,1399909916,,,,,,,12500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,l3iECgEAyzDJgodnQbC1og== +59007928281,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,59007928281,1399909916,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,XsE/1vcgp/7AMxwOzBTBhg== +57782745520,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,57782745520,1399909916,,,,,,,28000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,nSzvDWGwKEjFKKBw7XXFcA== +60675653012,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,60675653012,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,PAUSED,,eM/8hoq8okKhZMoB1GGS0w==,5JRNrRc5OrHRTM8hMs8ADw== +53669478365,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,53669478365,1399909916,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,9Oirip+WywzCuzpbTXorcA== +67495605528,2021-08-25T20:21:09.602,2021-08-25T20:21:15.316,UNSPECIFIED,SEARCH_STANDARD,67495605528,853120072,,,,,,,17500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,pWIcPXoMTd8p8ZiBX6pNCw== +23289502333,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23289502333,343273573,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,yOBKziaSfeNDXyh/0Bxp1Q== +23437386733,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23437386733,343273573,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,8bzbc8hoTrH52JpcPhMYcQ== +23262149533,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149533,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,OHuvAZnnycyUT66U6WRI+g== +23262149293,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149293,343273573,,,,,,,25000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,oRK/7iCw1jSQ6T58aHM43w== +23262149413,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149413,343273573,,,,,,,25000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,cC/fQ+l4O/008dYXm3rjPA== +23262149173,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,23262149173,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,yMIloAIamphW3cLfNKDnRw== +23661054253,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,OPTIMIZE,DISPLAY_STANDARD,23661054253,347984173,,,,,,,450000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,347984173,UNSPECIFIED,,PAUSED,,L9N+m+49Zy31Qyhh3hHbsw==,hw1PVsfBNzHjxK9eChd8eg== +50721178530,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,50721178530,1399909916,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1399909916,UNSPECIFIED,,ENABLED,,eM/8hoq8okKhZMoB1GGS0w==,Vq5teB085Q6bBdSWRwkYWw== +44654453181,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,44654453181,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,OchM9hPHDjfBHG/+BuTFmw== +48635019530,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,48635019530,853120072,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,bYq4SJQTdWsa9r2ra4CGPg== +46529218685,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,46529218685,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,5JRNrRc5OrHRTM8hMs8ADw== +43937217536,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217536,853120072,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,dPXQ0CAUvqTBp9uObhYTaA== +43937217736,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217736,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,9Oirip+WywzCuzpbTXorcA== +43937217976,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217976,853120072,,,,,,,12500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,l3iECgEAyzDJgodnQbC1og== +43937218536,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937218536,853120072,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,bWDYY4R5YY4hFNN6e+cmyg== +43937217056,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217056,853120072,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,ENABLED,,HIg1CiqC9WydVZPzaCMMmg==,XsE/1vcgp/7AMxwOzBTBhg== +43937217496,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,43937217496,853120072,,,,,,,28000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,nSzvDWGwKEjFKKBw7XXFcA== +51817201437,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,UNSPECIFIED,SEARCH_STANDARD,51817201437,853120072,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,853120072,UNSPECIFIED,,PAUSED,,HIg1CiqC9WydVZPzaCMMmg==,Vq5teB085Q6bBdSWRwkYWw== +51160711183,2021-08-25T20:21:09.602,2021-08-25T20:21:15.315,OPTIMIZE,DISPLAY_STANDARD,51160711183,1068458078,,,,,,,7000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,1068458078,UNSPECIFIED,,ENABLED,,aTIg0XwVsLY4T1/IBssjMg==,uW+f8HsyjSNAPwNIQq4tVg== +123130088562,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,UNSPECIFIED,SEARCH_STANDARD,123130088562,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,dS2l8GFXdXV2fMnw/4M8cA== +123130088522,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,ROTATE_FOREVER,SEARCH_STANDARD,123130088522,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,p/jOB+IWVWqZnVKrfwZZSA== +123130088762,2021-08-25T20:21:09.602,2021-08-25T20:21:15.368,UNSPECIFIED,SEARCH_STANDARD,123130088762,12872034128,,,,,,,15000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12872034128,UNSPECIFIED,,ENABLED,,DKeFsDBykEXaTjBz7Ow7Og==,ACYseD+ArWvEkQLMRU866Q== +115267581594,2021-08-25T20:21:09.602,2021-08-25T20:21:15.357,UNSPECIFIED,SEARCH_STANDARD,115267581594,10585797078,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,10585797078,UNSPECIFIED,,ENABLED,,u4quEw2JbeRImvRXD2Trzw==,p/jOB+IWVWqZnVKrfwZZSA== +112410973654,2021-08-25T20:21:09.602,2021-08-25T20:21:15.357,UNSPECIFIED,DISPLAY_STANDARD,112410973654,11679596622,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,11679596622,UNSPECIFIED,,ENABLED,,IGZK1Qv1Yy+OCkr/xF7pyA==,4Alew4qrf1hc5Dudzq3Dzg== +23262149053,2021-08-25T20:21:09.602,2021-08-25T20:21:15.314,UNSPECIFIED,SEARCH_STANDARD,23262149053,343273573,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,343273573,UNSPECIFIED,,ENABLED,,fSzS3i+cEvPtwoAP901I4w==,pDmuomxqSN6rWw5TUsrSQA== +123365957459,2021-08-25T20:21:09.602,2021-08-25T20:21:15.377,UNSPECIFIED,SEARCH_STANDARD,123365957459,13394597257,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13394597257,UNSPECIFIED,,ENABLED,,2q4X0Mq7Q1zY3OAP6qDwQg==,p/jOB+IWVWqZnVKrfwZZSA== +127701718208,2021-08-25T20:21:09.602,2021-08-25T20:21:15.387,OPTIMIZE,DISPLAY_STANDARD,127701718208,13047335654,,,,,,,4000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13047335654,UNSPECIFIED,,ENABLED,,WF1E+iJUjNQ1hBcCQSHkLg==,Dgdx4cvumsqzPS0LFplOjQ== +121614771753,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,UNSPECIFIED,DISPLAY_STANDARD,121614771753,12649004528,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004528,UNSPECIFIED,,ENABLED,,l0rupWpaKV14FVoYKVXa/A==,aOgzIZFTjWFu6C7ts/H6Cw== +121314851702,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,OPTIMIZE,DISPLAY_STANDARD,121314851702,13624090262,,,,,,,4000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13624090262,UNSPECIFIED,,ENABLED,,LqLxEd5TpCz+7+Y4rsJ8rw==,MRURW8Op+P/m1PnWaLw4jw== +121614771793,2021-08-25T20:21:09.602,2021-08-25T20:21:15.365,UNSPECIFIED,DISPLAY_STANDARD,121614771793,12649004531,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12649004531,UNSPECIFIED,,ENABLED,,5+E5FkXEIUbqRD8dsxqMnA==,GRLUBqIoAZoFVot+4MyrEw== +119807941826,2021-08-25T20:21:09.602,2021-08-25T20:21:15.363,UNSPECIFIED,DISPLAY_STANDARD,119807941826,12661488925,,,,,,,8000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,12661488925,UNSPECIFIED,,ENABLED,,bamZHp8M//g/wZkn+vEcMg==,aOgzIZFTjWFu6C7ts/H6Cw== +123862817162,2021-08-25T20:21:09.602,2021-08-25T20:21:15.384,OPTIMIZE,DISPLAY_STANDARD,123862817162,13073443628,,,,,,,3000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13073443628,UNSPECIFIED,,ENABLED,,OwgBvOxMOr/L4lKQFoFILQ==,Dgdx4cvumsqzPS0LFplOjQ== +102358069431,2021-08-25T20:21:09.602,2021-08-25T20:21:15.320,UNSPECIFIED,SEARCH_STANDARD,102358069431,9714806126,,,,,,,6200000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,9714806126,UNSPECIFIED,,REMOVED,,k0vhyISxowyWI/0nsdM52A==,bYq4SJQTdWsa9r2ra4CGPg== +102358069391,2021-08-25T20:21:09.602,2021-08-25T20:21:15.320,UNSPECIFIED,SEARCH_STANDARD,102358069391,9714806126,,,,,,,6200000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,9714806126,UNSPECIFIED,,REMOVED,,k0vhyISxowyWI/0nsdM52A==,e/jOBDm/oJw+eYig1/gswQ== +123365942779,2021-08-25T20:21:09.602,2021-08-25T20:21:15.373,UNSPECIFIED,SEARCH_STANDARD,123365942779,13394597224,,,,,,,7150000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,13394597224,UNSPECIFIED,,ENABLED,,QBtRes27/gex2z72qaMDgg==,p/jOB+IWVWqZnVKrfwZZSA== +83290854223,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,83290854223,8177394616,,,,,,,7500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,8177394616,UNSPECIFIED,,ENABLED,,qvMnu3BagNbM34MtxWzuiQ==,Xglfg5UzHVr7LcqmHRG0dA== +80249387743,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387743,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,zwSgLje3dPwxGkj2BcPFlw== +80249387703,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387703,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,CMjDoLXZJifyT+2Hiv2DJQ== +80249387503,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387503,7776638574,,,,,,,2340000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,PAUSED,,C35vU2KVzHAMi4J87zuq7Q==,+oTiAtSMShLUkBbvuRAAww== +80249387663,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,80249387663,7776638574,,,,,,,14440000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7776638574,UNSPECIFIED,,ENABLED,,C35vU2KVzHAMi4J87zuq7Q==,M7IEKlEgxTGqsNkhw9NobA== +82252391000,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252391000,6838862325,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862325,UNSPECIFIED,,ENABLED,,Rhb3xtXrLTXJx+sBTiv35w==,bYq4SJQTdWsa9r2ra4CGPg== +82252390960,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390960,6838862325,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862325,UNSPECIFIED,,ENABLED,,Rhb3xtXrLTXJx+sBTiv35w==,bWDYY4R5YY4hFNN6e+cmyg== +82252390720,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390720,6838862322,,,,,,,20000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862322,UNSPECIFIED,,ENABLED,,lYY67y/9rjNTtHRjrZM2DA==,bYq4SJQTdWsa9r2ra4CGPg== +82252390680,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,SEARCH_STANDARD,82252390680,6838862322,,,,,,,16000000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,6838862322,UNSPECIFIED,,ENABLED,,lYY67y/9rjNTtHRjrZM2DA==,bWDYY4R5YY4hFNN6e+cmyg== +81250598054,2021-08-25T20:21:09.602,2021-08-25T20:21:15.318,UNSPECIFIED,DISPLAY_STANDARD,81250598054,7979319798,,,,,,,3500000,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,7979319798,UNSPECIFIED,,ENABLED,,5CRdxH7BGHtvtrfvpMSWoQ==,0xBG8PJ7jVGuWjXXKa1joQ== +127791017758,2021-09-11T21:55:05,2021-09-12T08:21:56.009,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T00:59:15,2021-09-09T08:22:52.042,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-19T01:34:05,2021-09-19T11:18:11.689,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-11T16:00:56,2021-09-12T02:22:25.615,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-08T06:48:15,2021-09-08T14:24:06.752,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T10:36:03,2021-09-12T20:22:32.526,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T09:06:53,2021-09-09T20:23:06.838,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-13T00:36:39,2021-09-13T08:23:01.591,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T08:28:42,2021-09-10T20:22:38.643,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-11T03:48:43,2021-09-11T14:23:35.820,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-18T07:03:11,2021-09-18T20:23:23.158,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T14:54:27,2021-09-10T02:22:31.920,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T21:09:24,2021-09-10T08:23:54.237,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T16:10:54,2021-09-13T02:21:29.021,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T21:18:30,2021-09-11T08:22:24.852,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-12T04:14:52,2021-09-12T14:26:59.953,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-09T02:50:33,2021-09-09T14:23:42.449,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-08T18:25:49,2021-09-09T02:22:13.914,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== +127791017758,2021-09-10T02:54:37,2021-09-10T14:24:02.909,UNSPECIFIED,VIDEO_RESPONSIVE,127791017758,14565462146,,,,,,,0,10000,,,,,,,,,,,,,,,,UNSPECIFIED,,14565462146,KEYWORD,,ENABLED,,qhTkRByhQPGVa9GFevVaug==,Z7w7rsD7+oOH94wOKeVM1w== \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_history_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_history_data.csv new file mode 100644 index 0000000..2a30da7 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_history_data.csv @@ -0,0 +1,27 @@ +ad_group_id,id,updated_at,_fivetran_synced,action_items,ad_strength,added_by_google_ads,device_preference,display_url,final_app_urls,final_mobile_urls,final_url_suffix,final_urls,name,policy_summary_approval_status,policy_summary_review_status,status,system_managed_resource_source,tracking_url_template,type,url_collections +123365950779,525896765665,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365950779,525896765671,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365950779,525896765668,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365952859,525896766205,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365952859,525896766208,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832865,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832859,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365966299,525896832862,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416497,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416491,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960619,525845416494,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365960339,525845434008,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495961,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495964,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365969979,525845495958,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970219,525845495994,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970219,525845495997,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496129,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496132,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365970379,525845496126,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191777,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191783,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123859842613,530386191780,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290582,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290585,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] +123365942379,555276290588,2022-01-31 03:42:40,2022-01-31 20:21:16.288000,[],UNSPECIFIED,FALSE,UNSPECIFIED,,[],[],,[https://www.fivetran.com/signup],,APPROVED,REVIEWED,ENABLED,UNSPECIFIED,,EXPANDED_TEXT_AD,[] \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_stats_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_stats_data.csv new file mode 100644 index 0000000..50c8dd6 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_ad_stats_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,customer_id,date,_fivetran_synced,active_view_impressions,active_view_measurability,active_view_measurable_cost_micros,active_view_measurable_impressions,active_view_viewability,ad_group,ad_group_base_ad_group,ad_id,ad_network_type,campaign_base_campaign,campaign_id,clicks,conversions,conversions_value,cost_micros,device,impressions,interaction_event_types,interactions,keyword_ad_group_criterion,view_through_conversions ++oVKJN86MT4jtbpWTdzq5FKzxIk=,2121450128,2021-05-31,2021-06-30T14:21:51.597,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869462,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,400000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +ap+fpQLWMwzpCZRQ1vx1mqZVRko=,2121450128,2021-05-31,2021-06-30T14:21:51.595,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,3,0,0,20350000,DESKTOP,44,[CLICK],3,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +c6wkqjjdx//JMG6ZN1g6DZEgNzU=,2121450128,2021-05-31,2021-06-30T14:21:51.597,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,2,0,0,1760000,MOBILE,25,[CLICK],2,customers/2121450128/adGroupCriteria/100031227574~71669451,0 +RNvb6cEe55GnJx1NMcg7wAKPtrs=,2121450128,2021-05-31,2021-06-30T14:21:55.492,0,0,0,0,0,customers/2121450128/adGroups/100031227814,customers/2121450128/adGroups/100031227814,447123671939,SEARCH,customers/2121450128/campaigns/10059986072,10059986072,1,0,0,6870000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100031227814~71669451,0 +Inlx+IoFCvH1HCQNkMlVXbEkv08=,2121450128,2021-05-31,2021-06-30T14:21:57.449,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,440798626012,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,2,0,0,5750000,DESKTOP,20,[CLICK],2,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +F4eU72uHBZaPLMK721Jc7b8oFyk=,2121450128,2021-05-31,2021-06-30T14:21:57.449,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,440798626015,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,5,0,0,33090000,DESKTOP,216,[CLICK],5,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +vAtsKWH+yKd0vJ9URe+JQTTrLbo=,2121450128,2021-05-31,2021-06-30T14:21:57.450,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,521172639994,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,1,0,0,10020000,DESKTOP,51,[CLICK],1,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +d9psAM0NjCypw/glRQzggLzLU1o=,2121450128,2021-05-31,2021-06-30T14:21:57.451,0,0,0,0,0,customers/2121450128/adGroups/101951711506,customers/2121450128/adGroups/101951711506,521172639994,SEARCH,customers/2121450128/campaigns/10265563821,10265563821,1,0,0,2580000,MOBILE,39,[CLICK],1,customers/2121450128/adGroupCriteria/101951711506~71669451,0 +DWNXMorQm+s7LuTvCoSeWSPnrOM=,2121450128,2021-05-31,2021-06-30T14:21:58.227,0,0,0,0,0,customers/2121450128/adGroups/101951711666,customers/2121450128/adGroups/101951711666,440798626018,SEARCH,customers/2121450128/campaigns/10265563824,10265563824,1,0,0,510000,MOBILE,6,[CLICK],1,customers/2121450128/adGroupCriteria/101951711666~71669451,0 +1uA5l1aF2cpv9ro8ysKeYLCXngg=,2121450128,2021-05-31,2021-06-30T14:21:59.983,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372728,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,10220000,DESKTOP,61,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~71669451,0 +HMjeNQTWf6EmsGpncJKxf5QJ8xA=,2121450128,2021-05-31,2021-06-30T14:21:59.983,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,12720000,DESKTOP,59,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~71669451,0 +EI7r7yN8LvwrTaySho1BFiFXvu4=,2121450128,2021-05-31,2021-06-30T14:22:05.397,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,4,0,0,16720000,DESKTOP,71,[CLICK],4,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +18BxrfBf0yIX2sRHRlDU/grXCBE=,2121450128,2021-05-31,2021-06-30T14:22:05.398,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372749,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,2250000,MOBILE,9,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +d6exSZISKKaj30rkrOmO3ORJPQA=,2121450128,2021-05-31,2021-06-30T14:22:05.398,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,3540000,MOBILE,12,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~71669451,0 +0BYmZBpYQF6Bc2YcIuDIET89k5k=,2121450128,2021-05-31,2021-06-30T14:22:08.464,0,0,0,0,0,customers/2121450128/adGroups/116360595776,customers/2121450128/adGroups/116360595776,501663698086,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,4360000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/116360595776~71669451,0 +7PkcN+xyoYlKlp8Ek4Z//ds6XqM=,2121450128,2021-05-31,2021-06-30T14:22:08.657,0,0,0,0,0,customers/2121450128/adGroups/116360595976,customers/2121450128/adGroups/116360595976,489811287055,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7360000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/116360595976~71669451,0 +c2do31haXvOuFxgtDh81uHMORQQ=,2121450128,2021-05-31,2021-06-30T14:22:08.731,0,0,0,0,0,customers/2121450128/adGroups/117251040378,customers/2121450128/adGroups/117251040378,489811287487,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6250000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/117251040378~90123981,0 +oke0L3bSIX0klpQj8Cpn3GUYGDE=,2121450128,2021-05-31,2021-06-30T14:22:08.857,0,0,0,0,0,customers/2121450128/adGroups/117251040618,customers/2121450128/adGroups/117251040618,489811287289,SEARCH,customers/2121450128/campaigns/12000408920,12000408920,1,0,0,6310000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/117251040618~71669451,0 +qg2HBTFlPHil7xUUmIh+waqSsK8=,2121450128,2021-05-31,2021-06-30T14:22:09.572,0,0,0,0,0,customers/2121450128/adGroups/117280839484,customers/2121450128/adGroups/117280839484,488103213532,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,7510000,DESKTOP,50,[CLICK],1,customers/2121450128/adGroupCriteria/117280839484~89698374,0 +8jkuI/3pcO9QREU/lLzVCtXHTvI=,2121450128,2021-05-31,2021-06-30T14:22:10.111,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069827,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,7270000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/117819878825~71669451,0 +rqHHldhKwGCQBjp7ATp8o6/bPRA=,2121450128,2021-05-31,2021-06-30T14:22:11.108,0,0,0,0,0,customers/2121450128/adGroups/117819890145,customers/2121450128/adGroups/117819890145,501679544638,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,1,0,0,1380000,DESKTOP,20,[CLICK],1,customers/2121450128/adGroupCriteria/117819890145~71669451,0 +qkr+vdUQazL+dxepNLTVa43YNqI=,2121450128,2021-05-31,2021-06-30T14:22:11.267,0,0,0,0,0,customers/2121450128/adGroups/119841296085,customers/2121450128/adGroups/119841296085,517530516158,SEARCH,customers/2121450128/campaigns/12867542628,12867542628,1,0,0,6350000,DESKTOP,24,[CLICK],1,customers/2121450128/adGroupCriteria/119841296085~25487590,0 +RxnFia9JnBFINv2XEh2vtjzqbEk=,2121450128,2021-05-31,2021-06-30T14:22:09.406,0,0,0,0,0,customers/2121450128/adGroups/117280839284,customers/2121450128/adGroups/117280839284,488103213508,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,18600000,DESKTOP,14,[CLICK],1,customers/2121450128/adGroupCriteria/117280839284~501465725,0 +lz+5CY9dlIRbXprAls+BO45K3dA=,2121450128,2021-05-31,2021-06-30T14:22:09.642,0,0,0,0,0,customers/2121450128/adGroups/117280839484,customers/2121450128/adGroups/117280839484,491817470070,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,4740000,MOBILE,15,[CLICK],1,customers/2121450128/adGroupCriteria/117280839484~161179893,0 +656hn/z3/Yfv8yKD3cEr0hOLFWc=,2121450128,2021-05-31,2021-06-30T14:22:11.818,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814482,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6110000,DESKTOP,17,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~501465725,0 +BUvy1RLcC4Mk1px9ftxBIEySiKs=,2121450128,2021-05-31,2021-06-30T14:22:11.818,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6280000,DESKTOP,10,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~501465725,0 +eYaVw07jXFkIo3Vo6l4mEyJUlX0=,2121450128,2021-05-31,2021-06-30T14:22:08.751,0,0,0,0,0,customers/2121450128/adGroups/117251040378,customers/2121450128/adGroups/117251040378,489811287487,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6040000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/117251040378~1522787749,0 +105XI6w8DXEenKQ+SqbOrQQQO4k=,2121450128,2021-05-31,2021-06-30T14:22:09.454,0,0,0,0,0,customers/2121450128/adGroups/117280839284,customers/2121450128/adGroups/117280839284,491817470064,SEARCH,customers/2121450128/campaigns/11911792036,11911792036,1,0,0,13590000,MOBILE,2,[CLICK],1,customers/2121450128/adGroupCriteria/117280839284~1522787749,0 +pJ5VAAl83A75jr7hR+XU6k1E310=,2121450128,2021-05-31,2021-06-30T14:21:47.722,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,501663698053,SEARCH,customers/2121450128/campaigns/344106493,344106493,1,0,0,4160000,DESKTOP,11,[CLICK],1,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +FjtEeA0LBJ5b7c3SUGc4y/bFCu0=,2121450128,2021-05-31,2021-06-30T14:21:47.703,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658632,SEARCH,customers/2121450128/campaigns/344106493,344106493,2,0,0,11600000,DESKTOP,10,[CLICK],2,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +Hjk2/EBAi2Oy3kJuFYte9qHT53k=,2121450128,2021-05-31,2021-06-30T14:21:47.720,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658635,SEARCH,customers/2121450128/campaigns/344106493,344106493,2,0,0,9620000,DESKTOP,16,[CLICK],2,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +zuxIvK3b0e7navO6hLYMmi90zIY=,2121450128,2021-05-31,2021-06-30T14:21:47.661,0,0,0,0,0,customers/2121450128/adGroups/23289504013,customers/2121450128/adGroups/23289504013,476435658629,SEARCH,customers/2121450128/campaigns/344106493,344106493,3,0,0,8970000,DESKTOP,17,[CLICK],3,customers/2121450128/adGroupCriteria/23289504013~59284563270,0 +bFjuQLq4Y9bzd6jCCoLr44+POsE=,2121450128,2021-05-31,2021-06-30T14:21:51.322,0,0,0,0,0,customers/2121450128/adGroups/99966172536,customers/2121450128/adGroups/99966172536,489811287037,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,4680000,MOBILE,2,[CLICK],1,customers/2121450128/adGroupCriteria/99966172536~39447438670,0 +ywN4XbKlPdZ4Y7SVwbIm1Omt+A4=,2121450128,2021-05-31,2021-06-30T14:21:52.443,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869465,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,350000,MOBILE,20,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24010400560,0 +wgLN27cvOriL3o0UL/anK/taKrw=,2121450128,2021-05-31,2021-06-30T14:21:52.441,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,514818869465,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,1560000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24010400560,0 +U8E94M7NzgDUzOlquZAywv7ZwYc=,2121450128,2021-05-31,2021-06-30T14:21:52.700,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,8700000,DESKTOP,46,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24314127775,0 +g3Qk03aAjAjpHSaDx5/pXbRAoOc=,2121450128,2021-05-31,2021-06-30T14:21:52.705,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,730000,MOBILE,21,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~24314127775,0 +xb0wersc/oE/Qtvp3O5I5Tetqfo=,2121450128,2021-05-31,2021-06-30T14:21:52.923,0,0,0,0,0,customers/2121450128/adGroups/100031227574,customers/2121450128/adGroups/100031227574,435370163955,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,5700000,DESKTOP,14,[CLICK],1,customers/2121450128/adGroupCriteria/100031227574~39447438670,0 +4qBfyK0ELOIJcIZuSN8Q7NEBaYA=,2121450128,2021-05-31,2021-06-30T14:21:54.306,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,10000000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418504627,0 +8qn5c4H0FZ/OQegiUXAaKZ7SW2Q=,2121450128,2021-05-31,2021-06-30T14:21:54.305,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869468,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,2950000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418504627,0 +skGNPEPQ17ScvvYa8JGfaVBbk0I=,2121450128,2021-05-31,2021-06-30T14:21:54.475,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869468,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,1250000,DESKTOP,19,[CLICK],1,customers/2121450128/adGroupCriteria/100031227614~19418511347,0 +2mCEo6O1t0vIVtgooC/7dznSP48=,2121450128,2021-05-31,2021-06-30T14:21:54.776,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,2,0,0,4350000,DESKTOP,28,[CLICK],2,customers/2121450128/adGroupCriteria/100031227614~24055148960,0 +7ffyuBPp05kVyl9J/I/osI8OAdE=,2121450128,2021-05-31,2021-06-30T14:21:54.778,0,0,0,0,0,customers/2121450128/adGroups/100031227614,customers/2121450128/adGroups/100031227614,514818869471,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,3,0,0,2920000,MOBILE,26,[CLICK],3,customers/2121450128/adGroupCriteria/100031227614~24055148960,0 +zSplpYiICMhSICVSoVW1W8IDrkg=,2121450128,2021-05-31,2021-06-30T14:21:55.147,0,0,0,0,0,customers/2121450128/adGroups/100031227654,customers/2121450128/adGroups/100031227654,514818869474,SEARCH,customers/2121450128/campaigns/10059986060,10059986060,1,0,0,2190000,DESKTOP,22,[CLICK],1,customers/2121450128/adGroupCriteria/100031227654~19689304787,0 +FL93LU78YH7W7q1hFLEPk8+WEzw=,2121450128,2021-05-31,2021-06-30T14:21:55.599,0,0,0,0,0,customers/2121450128/adGroups/100031227814,customers/2121450128/adGroups/100031227814,447123671936,SEARCH,customers/2121450128/campaigns/10059986072,10059986072,1,0,0,4590000,MOBILE,4,[CLICK],1,customers/2121450128/adGroupCriteria/100031227814~24314127775,0 +VfME9/Mr5P3WXKeeA97BZn9ffAE=,2121450128,2021-05-31,2021-06-30T14:21:56.503,0,0,0,0,0,customers/2121450128/adGroups/100036258295,customers/2121450128/adGroups/100036258295,428943607631,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,5810000,MOBILE,13,[CLICK],1,customers/2121450128/adGroupCriteria/100036258295~39447438670,0 +xNtt6hXkPk/sacDpsp7qWwvZ3jw=,2121450128,2021-05-31,2021-06-30T14:21:56.502,0,0,0,0,0,customers/2121450128/adGroups/100036258295,customers/2121450128/adGroups/100036258295,491819326258,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,9800000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/100036258295~39447438670,0 +LSdVe4Y6fsNAQkuag64zFWGM/bk=,2121450128,2021-05-31,2021-06-30T14:21:56.756,0,0,0,0,0,customers/2121450128/adGroups/100036258455,customers/2121450128/adGroups/100036258455,491806298580,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,13730000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/100036258455~19418511347,0 +yjU8RkTbviDB4god0VvfrLLz78I=,2121450128,2021-05-31,2021-06-30T14:21:57.065,0,0,0,0,0,customers/2121450128/adGroups/100036258455,customers/2121450128/adGroups/100036258455,491806298580,SEARCH,customers/2121450128/campaigns/9714806126,9714806126,1,0,0,23580000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/100036258455~29554867064,0 +PA9rSKFC5GVFTs2YoGPgZGiFVnk=,2121450128,2021-05-31,2021-06-30T14:21:59.514,0,0,0,0,0,customers/2121450128/adGroups/102174442962,customers/2121450128/adGroups/102174442962,432430823447,SEARCH,customers/2121450128/campaigns/9928118134,9928118134,1,0,0,75530000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/102174442962~19418511347,0 +fHfi9GHmNCjaKOtctOPx/F59NK0=,2121450128,2021-05-31,2021-06-30T14:21:59.665,0,0,0,0,0,customers/2121450128/adGroups/102174443002,customers/2121450128/adGroups/102174443002,432430823453,SEARCH,customers/2121450128/campaigns/9928118134,9928118134,1,0,0,74960000,DESKTOP,38,[CLICK],1,customers/2121450128/adGroupCriteria/102174443002~19689304787,0 +Nm6txp7eOi8DxrzJaZYScCgIGJM=,2121450128,2021-05-31,2021-06-30T14:22:00.180,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,2,0,0,11000000,DESKTOP,40,[CLICK],2,customers/2121450128/adGroupCriteria/104933764975~24314127775,0 +CodlUlWgL9YKKiBUh0ONBaOd9IQ=,2121450128,2021-05-31,2021-06-30T14:22:00.231,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372731,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,6340000,DESKTOP,6,[CLICK],1,customers/2121450128/adGroupCriteria/104933764975~39447438670,0 +iLwtcym6lFMRmaSEfzPjOuTMIFk=,2121450128,2021-05-31,2021-06-30T14:22:00.230,0,0,0,0,0,customers/2121450128/adGroups/104933764975,customers/2121450128/adGroups/104933764975,479686372728,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,2890000,DESKTOP,34,[CLICK],1,customers/2121450128/adGroupCriteria/104933764975~39447438670,0 +4IU5XSBhCB19ogiZdH3uvv9i+rM=,2121450128,2021-05-31,2021-06-30T14:22:00.736,0,0,0,0,0,customers/2121450128/adGroups/104933765015,customers/2121450128/adGroups/104933765015,479686372734,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,5970000,DESKTOP,48,[CLICK],1,customers/2121450128/adGroupCriteria/104933765015~19418511347,0 +Gc57fzxkdG98ewspASzoglK1yR8=,2121450128,2021-05-31,2021-06-30T14:22:00.796,0,0,0,0,0,customers/2121450128/adGroups/104933765015,customers/2121450128/adGroups/104933765015,479686372737,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,3390000,DESKTOP,1,[CLICK],1,customers/2121450128/adGroupCriteria/104933765015~20820075849,0 +2fF0zmHuUgScx3pv8HmTwx3j/DM=,2121450128,2021-05-31,2021-06-30T14:22:00.966,0,0,0,0,0,customers/2121450128/adGroups/104933765175,customers/2121450128/adGroups/104933765175,479686372740,SEARCH,customers/2121450128/campaigns/10587155721,10587155721,1,0,0,5150000,DESKTOP,88,[CLICK],1,customers/2121450128/adGroupCriteria/104933765175~19689304787,0 +rAKUJOWLBBRBugN2uctqYe4QYO0=,2121450128,2021-05-31,2021-06-30T14:22:04.172,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8840000,DESKTOP,19,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~24010400560,0 ++FYF1rP83I6SAsGO4sqbUq7JfZE=,2121450128,2021-05-31,2021-06-30T14:22:04.209,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,2,0,0,18960000,DESKTOP,72,[CLICK],2,customers/2121450128/adGroupCriteria/105484728914~24314127775,0 +0x5KhXJdfYyVa1yQExBqsLXmBmU=,2121450128,2021-05-31,2021-06-30T14:22:04.210,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,5240000,MOBILE,20,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~24314127775,0 +Kri0injwkAQiTrxf9ifvTE6P3pw=,2121450128,2021-05-31,2021-06-30T14:22:04.265,0,0,0,0,0,customers/2121450128/adGroups/105484728914,customers/2121450128/adGroups/105484728914,479686372692,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,7110000,DESKTOP,31,[CLICK],1,customers/2121450128/adGroupCriteria/105484728914~39447438670,0 +FsE0Ssf6rdIu/b5Kagm9Jbv+ja8=,2121450128,2021-05-31,2021-06-30T14:22:04.582,0,0,0,0,0,customers/2121450128/adGroups/105484728954,customers/2121450128/adGroups/105484728954,479686372698,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8930000,DESKTOP,24,[CLICK],1,customers/2121450128/adGroupCriteria/105484728954~19418511347,0 +85GH3UxqzDOim/yJp4ErS08TFLE=,2121450128,2021-05-31,2021-06-30T14:22:04.977,0,0,0,0,0,customers/2121450128/adGroups/105484729114,customers/2121450128/adGroups/105484729114,479686372707,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8240000,MOBILE,10,[CLICK],1,customers/2121450128/adGroupCriteria/105484729114~19689304787,0 +BfaV8UEEqfg+KezVKDmPhj6lDFs=,2121450128,2021-05-31,2021-06-30T14:22:04.976,0,0,0,0,0,customers/2121450128/adGroups/105484729114,customers/2121450128/adGroups/105484729114,479686372704,SEARCH,customers/2121450128/campaigns/10266487349,10266487349,1,0,0,8350000,DESKTOP,61,[CLICK],1,customers/2121450128/adGroupCriteria/105484729114~19689304787,0 +wt37ofNgeVcfic1HvCQKLl5HgGk=,2121450128,2021-05-31,2021-06-30T14:22:05.545,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,2,0,0,6470000,DESKTOP,38,[CLICK],2,customers/2121450128/adGroupCriteria/106366276743~39447438670,0 +z/KP1bFoC2EBieisqN/vCMsyXdI=,2121450128,2021-05-31,2021-06-30T14:22:05.546,0,0,0,0,0,customers/2121450128/adGroups/106366276743,customers/2121450128/adGroups/106366276743,479686372746,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,2280000,TABLET,1,[CLICK],1,customers/2121450128/adGroupCriteria/106366276743~39447438670,0 +Ltrw5I+MGMXEzvTb4ixSUkfCEvo=,2121450128,2021-05-31,2021-06-30T14:22:05.774,0,0,0,0,0,customers/2121450128/adGroups/106366276943,customers/2121450128/adGroups/106366276943,479686372752,SEARCH,customers/2121450128/campaigns/10965621313,10965621313,1,0,0,5800000,MOBILE,46,[CLICK],1,customers/2121450128/adGroupCriteria/106366276943~19689304787,0 +2+gOKTYfAEu+Fr/4hvgv6O9/sEw=,2121450128,2021-05-31,2021-06-30T14:22:08.307,0,0,0,0,0,customers/2121450128/adGroups/114921466265,customers/2121450128/adGroups/114921466265,489811287109,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,6430000,DESKTOP,8,[CLICK],1,customers/2121450128/adGroupCriteria/114921466265~39447438670,0 +PwmN3XOod0yuW3gdkSueGlh2h+M=,2121450128,2021-05-31,2021-06-30T14:22:08.309,0,0,0,0,0,customers/2121450128/adGroups/114921466265,customers/2121450128/adGroups/114921466265,501663698065,SEARCH,customers/2121450128/campaigns/11896235006,11896235006,1,0,0,3690000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/114921466265~39447438670,0 +HXdP5nae906jJeQ8nKXo9cDjPEg=,2121450128,2021-05-31,2021-06-30T14:22:08.380,0,0,0,0,0,customers/2121450128/adGroups/115267581594,customers/2121450128/adGroups/115267581594,514470814272,SEARCH,customers/2121450128/campaigns/10585797078,10585797078,2,0,0,6660000,MOBILE,6,[CLICK],2,customers/2121450128/adGroupCriteria/115267581594~20080213458,0 +7tgWYoxmF5xy3qGG10PlOYlHuPU=,2121450128,2021-05-31,2021-06-30T14:22:08.826,0,0,0,0,0,customers/2121450128/adGroups/117251040418,customers/2121450128/adGroups/117251040418,489811287499,SEARCH,customers/2121450128/campaigns/12000408923,12000408923,1,0,0,6320000,DESKTOP,23,[CLICK],1,customers/2121450128/adGroupCriteria/117251040418~19689304787,0 +7QJraBE/0BxJf6t6bemmJ7KH6wE=,2121450128,2021-05-31,2021-06-30T14:22:10.256,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069962,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,8490000,DESKTOP,11,[CLICK],2,customers/2121450128/adGroupCriteria/117819878825~24314127775,0 +4hNQX8IXH8jfYFj9qrTxOAZZCa0=,2121450128,2021-05-31,2021-06-30T14:22:10.308,0,0,0,0,0,customers/2121450128/adGroups/117819878825,customers/2121450128/adGroups/117819878825,501720069827,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,4850000,DESKTOP,37,[CLICK],2,customers/2121450128/adGroupCriteria/117819878825~39447438670,0 +OsBMfZJakpK+CleYkLdm/M3PS6c=,2121450128,2021-05-31,2021-06-30T14:22:10.614,0,0,0,0,0,customers/2121450128/adGroups/117819878865,customers/2121450128/adGroups/117819878865,501720069986,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,3800000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/117819878865~29554867064,0 +Y12Hl71oH/FKLUwjUC1bWojskTY=,2121450128,2021-05-31,2021-06-30T14:22:10.614,0,0,0,0,0,customers/2121450128/adGroups/117819878865,customers/2121450128/adGroups/117819878865,501720069980,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,9870000,DESKTOP,31,[CLICK],2,customers/2121450128/adGroupCriteria/117819878865~29554867064,0 +bPKzrcwPaN/VpAuB17n7M+sOH3k=,2121450128,2021-05-31,2021-06-30T14:22:10.654,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720070013,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,11420000,DESKTOP,85,[CLICK],1,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +KHEWQUEG62xm6x9VYujNUYoYicQ=,2121450128,2021-05-31,2021-06-30T14:22:10.653,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720069998,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,2,0,0,4600000,DESKTOP,99,[CLICK],2,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +DZn1rXI5fSEZBcmiaWT9IB9l39o=,2121450128,2021-05-31,2021-06-30T14:22:10.664,0,0,0,0,0,customers/2121450128/adGroups/117819879025,customers/2121450128/adGroups/117819879025,501720069998,SEARCH,customers/2121450128/campaigns/12443653577,12443653577,1,0,0,5660000,MOBILE,10,[CLICK],1,customers/2121450128/adGroupCriteria/117819879025~19689304787,0 +P5XYeo3L56JHlnQRIpj1WASSBPI=,2121450128,2021-05-31,2021-06-30T14:22:11.055,0,0,0,0,0,customers/2121450128/adGroups/117819889425,customers/2121450128/adGroups/117819889425,501719794547,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,1,0,0,2200000,DESKTOP,3,[CLICK],1,customers/2121450128/adGroupCriteria/117819889425~24314127775,0 +xHkBLqBScvSOxE01fZtBi3pqsFM=,2121450128,2021-05-31,2021-06-30T14:22:11.055,0,0,0,0,0,customers/2121450128/adGroups/117819889425,customers/2121450128/adGroups/117819889425,501719794523,SEARCH,customers/2121450128/campaigns/12443653583,12443653583,2,0,0,5390000,DESKTOP,4,[CLICK],2,customers/2121450128/adGroupCriteria/117819889425~24314127775,0 +o2XKa9yvKPGlVvdmjzlJoZUeniQ=,2121450128,2021-05-31,2021-06-30T14:22:11.882,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814482,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,7260000,DESKTOP,29,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~19418511347,0 +Z1EzY3+p1FPLzEMLrFzE3Sb1kiw=,2121450128,2021-05-31,2021-06-30T14:22:11.960,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,2,0,0,11040000,DESKTOP,58,[CLICK],2,customers/2121450128/adGroupCriteria/122377267104~24055148960,0 +2mNqGnW2Fgzo6TYDyvG03xqZbmg=,2121450128,2021-05-31,2021-06-30T14:22:11.977,0,0,0,0,0,customers/2121450128/adGroups/122377267104,customers/2121450128/adGroups/122377267104,514470814485,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4170000,MOBILE,27,[CLICK],1,customers/2121450128/adGroupCriteria/122377267104~29554867064,0 +udmr23DjE9hdNmN84/QrASgdJBw=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814503,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,4,0,0,18030000,MOBILE,49,[CLICK],4,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +BkDUpZeilwnyPN53IENCMs0Lc+M=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814509,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4450000,MOBILE,3,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +ftYXFB4nHbkIzMiy3vFMkVtxecg=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814515,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,7990000,DESKTOP,62,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +RX+zW0CREKfkhK+golcy6Rcr3ic=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814506,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,6930000,DESKTOP,16,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +lFcV7l8RGUCeXNLztqzNuP38EHc=,2121450128,2021-05-31,2021-06-30T14:22:12.012,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814512,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,1,0,0,4450000,MOBILE,14,[CLICK],1,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +eQM4qYYjFZ7bNPaA45xGBQbh+20=,2121450128,2021-05-31,2021-06-30T14:22:12.011,0,0,0,0,0,customers/2121450128/adGroups/122377267144,customers/2121450128/adGroups/122377267144,514470814503,SEARCH,customers/2121450128/campaigns/11894469516,11894469516,3,0,0,19380000,DESKTOP,196,[CLICK],3,customers/2121450128/adGroupCriteria/122377267144~19689304787,0 +EjAdaDaQHB99A17PP0wGZMiF1nM=,2121450128,2021-05-31,2021-06-30T14:22:13.108,0,0,0,0,0,customers/2121450128/adGroups/123130090002,customers/2121450128/adGroups/123130090002,517571734739,SEARCH,customers/2121450128/campaigns/12872034134,12872034134,1,0,0,4140000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/123130090002~29554867064,0 +ORcCgtQCS3x0tSTC8OwbLQ0H+EY=,2121450128,2021-05-31,2021-06-30T14:22:13.142,0,0,0,0,0,customers/2121450128/adGroups/123130090042,customers/2121450128/adGroups/123130090042,517571734772,SEARCH,customers/2121450128/campaigns/12872034134,12872034134,2,0,0,9520000,MOBILE,5,[CLICK],2,customers/2121450128/adGroupCriteria/123130090042~19689304787,0 +O2RdbQQWj5uLSCJ9aMLpLz1p9XE=,2121450128,2021-05-31,2021-06-30T14:22:13.211,0,0,0,0,0,customers/2121450128/adGroups/123130090282,customers/2121450128/adGroups/123130090282,517571735012,SEARCH,customers/2121450128/campaigns/12872034137,12872034137,1,0,0,6380000,DESKTOP,4,[CLICK],1,customers/2121450128/adGroupCriteria/123130090282~39447438670,0 +5geOZqztFqAv9bmLJQF7v5dj80k=,2121450128,2021-05-31,2021-06-30T14:21:49.979,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,17120000,DESKTOP,9,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~312002208229,0 +wCh9A7/vTQyNvqwUH2/Jge5ZDIQ=,2121450128,2021-05-31,2021-06-30T14:21:50.007,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,6890000,DESKTOP,10,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~336544926909,0 +CT7zIpLk5Avs8jr62hp1O+Uhl2o=,2121450128,2021-05-31,2021-06-30T14:21:50.053,0,0,0,0,0,customers/2121450128/adGroups/59805957993,customers/2121450128/adGroups/59805957993,476435658638,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,9140000,DESKTOP,7,[CLICK],1,customers/2121450128/adGroupCriteria/59805957993~489548954784,0 +ixGZ2/muZszBJ4epCcEc0z3FVbE=,2121450128,2021-05-31,2021-06-30T14:21:51.148,0,0,0,0,0,customers/2121450128/adGroups/99321637919,customers/2121450128/adGroups/99321637919,430843880058,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7210000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/99321637919~926646516844,0 +mddIGSs89XLnhR9PX6luN8wv2Eo=,2121450128,2021-05-31,2021-06-30T14:21:51.151,0,0,0,0,0,customers/2121450128/adGroups/99321638079,customers/2121450128/adGroups/99321638079,430843880067,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,7310000,DESKTOP,2,[CLICK],1,customers/2121450128/adGroupCriteria/99321638079~449404825186,0 +X2nI/QJndjpQGwQqUOn5A6E3rug=,2121450128,2021-05-31,2021-06-30T14:21:51.170,0,0,0,0,0,customers/2121450128/adGroups/99321638079,customers/2121450128/adGroups/99321638079,430843880067,SEARCH,customers/2121450128/campaigns/1523055818,1523055818,1,0,0,6640000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/99321638079~509484669322,0 ++Uvfkuu1X0bb2shJJB/R7g4xcYs=,2121450128,2021-05-31,2021-06-30T14:21:51.241,0,0,0,0,0,customers/2121450128/adGroups/99321638839,customers/2121450128/adGroups/99321638839,430843880280,SEARCH,customers/2121450128/campaigns/9810839003,9810839003,1,0,0,7150000,DESKTOP,5,[CLICK],1,customers/2121450128/adGroupCriteria/99321638839~449404825186,0 +EZeRxw3EqJuLwgrNjT9ujPsVinw=,2121450128,2021-05-31,2021-06-30T14:21:51.371,0,0,0,0,0,customers/2121450128/adGroups/100031226934,customers/2121450128/adGroups/100031226934,466828599534,SEARCH,customers/2121450128/campaigns/10059986066,10059986066,1,0,0,3350000,MOBILE,1,[CLICK],1,customers/2121450128/adGroupCriteria/100031226934~313277999221,0 \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_campaign_history_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_campaign_history_data.csv new file mode 100644 index 0000000..fa032f6 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_campaign_history_data.csv @@ -0,0 +1,101 @@ +id,updated_at,_fivetran_synced,ad_serving_optimization_status,advertising_channel_subtype,advertising_channel_type,base_campaign_id,bidding_strategy_bid_ceiling,bidding_strategy_bid_changes_for_raises_only,bidding_strategy_bid_floor,bidding_strategy_bid_modifier,bidding_strategy_competitor_domain,bidding_strategy_cpa_bid_amount,bidding_strategy_cpc_bid_amount,bidding_strategy_cpm_bid_amount,bidding_strategy_enhanced_cpc_enabled,bidding_strategy_id,bidding_strategy_max_cpc_bid_ceiling,bidding_strategy_max_cpc_bid_floor,bidding_strategy_name,bidding_strategy_raise_bid_when_budget_constrained,bidding_strategy_raise_bid_when_low_quality_score,bidding_strategy_scheme_type,bidding_strategy_source,bidding_strategy_spend_target,bidding_strategy_strategy_goal,bidding_strategy_target_cpa,bidding_strategy_target_outrank_share,bidding_strategy_target_roas,bidding_strategy_target_roas_override,bidding_strategy_type,bidding_strategy_viewable_cpm_enabled,campaign_group_id,campaign_trial_type,customer_id,end_date,final_url_suffix,frequency_cap_impressions,frequency_cap_level,frequency_cap_time_unit,network_setting_target_content_network,network_setting_target_google_search,network_setting_target_partner_search_network,network_setting_target_search_network,serving_status,start_date,status,tracking_url_template,vanity_pharma_display_url_mode,vanity_pharma_text,name +14432604647,2021-09-01T09:21:46,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604647,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,O2aBk1MBJq48WpSF/o18SQ== +14432604650,2021-09-01T09:23:13,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604650,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,OGBKBzE1Kk+kWe5Ktya3Dg== +14432604653,2021-09-01T09:23:15,2021-09-01T20:21:48.146,OPTIMIZE,UNSPECIFIED,VIDEO,14432604653,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPV,,,BASE,2121450128,2037-12-30,,,,,false,false,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,DgyvOij7pu6daVAQVKAiSA== +13394597236,2021-08-29T06:26:50,2021-08-29T14:24:29.907,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597275,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597236,2021-08-30T07:20:19,2021-08-30T20:21:44.203,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597236,2021-08-31T07:17:17,2021-08-31T14:22:54.717,OPTIMIZE,UNSPECIFIED,SEARCH,13394597236,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,bEmL0ZJyXyDfa0dWzgbl5g== +13394597275,2021-08-30T06:23:01,2021-08-30T14:23:43.169,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597275,2021-08-30T07:26:05,2021-08-30T20:21:44.210,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +13394597275,2021-08-31T07:17:17,2021-08-31T14:22:54.718,OPTIMIZE,UNSPECIFIED,SEARCH,13394597275,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,PAUSED,,UNSPECIFIED,UNSPECIFIED,y1XNg5utzDdJWJFLkzbFvA== +14432171240,2021-09-04T02:16:24,2021-09-04T14:27:24.989,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,14432171240,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,15N+CHN1U9fezwcOilbxoA== +14432171240,2021-09-05T01:47:30,2021-09-05T14:24:36.918,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,14432171240,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-08-27,ENABLED,,UNSPECIFIED,UNSPECIFIED,15N+CHN1U9fezwcOilbxoA== +13394597401,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-08-30T06:23:01,2021-08-30T14:23:43.169,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-08-31T07:17:17,2021-08-31T14:22:54.719,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-01T07:54:51,2021-09-01T20:21:48.138,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-02T10:23:26,2021-09-02T20:22:28.858,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-03T10:56:02,2021-09-03T20:22:27.458,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597401,2021-09-04T12:34:07,2021-09-05T02:21:52.938,OPTIMIZE,UNSPECIFIED,SEARCH,13394597401,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,mSs4+ZI2bNuFLn+TXwk6fg== +13394597410,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-01T07:54:51,2021-09-01T20:21:48.139,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597410,2021-09-04T12:34:07,2021-09-05T02:21:52.938,OPTIMIZE,UNSPECIFIED,SEARCH,13394597410,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,TypTBRshC89GQ06gK8lEZg== +13394597413,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-01T07:54:51,2021-09-01T20:21:48.139,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597413,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597413,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,ok3WgWaPXCPGVvouINHgfg== +13394597416,2021-08-29T06:26:50,2021-08-29T14:24:29.909,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-01T07:54:51,2021-09-01T20:21:48.142,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +13394597416,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597416,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,M4NuMtZbSXjeQNlMbLB0Lw== +14086723368,2021-08-29T06:26:50,2021-08-29T14:24:29.913,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-08-30T06:23:01,2021-08-30T14:23:43.190,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-08-31T07:17:17,2021-08-31T14:22:54.724,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-01T07:54:51,2021-09-01T20:21:48.146,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-02T10:23:26,2021-09-02T20:22:28.879,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-03T10:56:02,2021-09-03T20:22:27.463,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +14086723368,2021-09-04T12:34:07,2021-09-05T02:21:52.942,ROTATE_INDEFINITELY,UNSPECIFIED,SEARCH,10121581152,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,EXPERIMENT,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-07-30,ENABLED,,UNSPECIFIED,UNSPECIFIED,r7GqBniH/c44XpuqBMAciA== +13394597419,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-08-31T07:17:17,2021-08-31T14:22:54.721,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597419,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597419,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,HXpts9L5/+UK2VjB6Md7Lg== +13394597422,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-03T10:56:02,2021-09-03T20:22:27.459,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597422,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597422,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,MuJn70tNKrY0+RJFIgkBiw== +13394597425,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-02T10:23:26,2021-09-02T20:22:28.859,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597425,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597425,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,Y/10/B3VzOeHu2ge1BxpvQ== +13394597428,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597428,2021-09-04T12:34:07,2021-09-05T02:21:52.939,OPTIMIZE,UNSPECIFIED,SEARCH,13394597428,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,/KbW48ZcdH3tOl/x7EYvNg== +13394597434,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597434,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597434,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,G8zQgo7bRj3dknQpLxaRLA== +13394597437,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-01T07:54:51,2021-09-01T20:21:48.143,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597437,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597437,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,KVIBnRYkPvBQsTu1j8tDWg== +13394597440,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-01T07:54:51,2021-09-01T20:21:48.144,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-02T10:23:26,2021-09-02T20:22:28.860,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-03T10:56:02,2021-09-03T20:22:27.460,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597440,2021-09-04T12:34:07,2021-09-05T02:21:52.940,OPTIMIZE,UNSPECIFIED,SEARCH,13394597440,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,CCL5mIgmu8nnucN5YMtVVQ== +13394597443,2021-08-29T06:26:50,2021-08-29T14:24:29.910,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-08-30T06:23:01,2021-08-30T14:23:43.183,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-08-31T07:17:17,2021-08-31T14:22:54.722,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== +13394597443,2021-09-01T07:54:51,2021-09-01T20:21:48.144,OPTIMIZE,UNSPECIFIED,SEARCH,13394597443,,,,,,,0,0,,,,,,,,,,,,,,,,MANUAL_CPC,,,BASE,2121450128,2037-12-30,,,,,false,true,false,false,SERVING,2021-06-04,ENABLED,,UNSPECIFIED,UNSPECIFIED,5PqXYnnrrechvW+1t75jHg== \ No newline at end of file diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_click_performance_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_click_performance_data.csv new file mode 100644 index 0000000..c90ada9 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_click_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,criteria_id,date,external_customer_id,gcl_id +6R2pKfyVIlplWFrmSMEjTdb7Lg4=,2020-10-06 22:13:10.831 UTC,p6zp17DVJVjAD3VAr1btVw==,107253667331,G+b561Y/O/hceLQhm/Cd6Q==,enabled,10121482518,f+NTeTOsnxPzAuGNT9eQYQ==,enabled,1,336544926909,2020-07-08,2121450128,EAIaIQobChMI5KWC0aW96gIVCZzVCh2ZQAcnEAAYASAAEgJBwvD_BwE +ny5pgpTV/5vT6RhUuFZUbW3r4Kg=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893863172,bYq4SJQTdWsa9r2ra4CGPg==,enabled,9935249277,2tzxA1l6Ptm/4RLBmRS+1w==,paused,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLrBTGBvN9DgQVyYN8z-51i3heXdWZ0f1POR-ZEkP5lcH6FHOx2_IMaAumHEALw_wcB +lrsPJ1JB1x0GyZRN5OOFRay0QnM=,2020-10-06 22:13:10.559 UTC,p6zp17DVJVjAD3VAr1btVw==,100031227654,cyHII+mGcUpsI+9j29woWA==,enabled,10059986060,Xxz8EaV/WN0fSpW/YDAZpQ==,enabled,2,19689304787,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZI4NBFyroqj9GvKKABn6CsY8jLYVa-bY0N3XKcMihnXENYafgsHRo8aAoEQEALw_wcB +VS9bToG/sOowwsEOmRVQrub8zT8=,2020-10-06 22:13:10.442 UTC,p6zp17DVJVjAD3VAr1btVw==,105484729354,7fFDkHWoOkR/uLYw3cnI3g==,enabled,10266487352,BcfGmjNq/QzyOOkely2k4w==,paused,1,509484669322,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLypa25WHwLrEHRpTDMYOGnbXawB398vj21q1yNShRd0DHRk7DAXtkaAgHjEALw_wcB +Yh3++FAL6LW3b36K/eAxhzAsK5k=,2020-10-06 22:13:11.123 UTC,p6zp17DVJVjAD3VAr1btVw==,105484729354,7fFDkHWoOkR/uLYw3cnI3g==,enabled,10266487352,BcfGmjNq/QzyOOkely2k4w==,paused,1,926646524284,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJPGlCSMuBJ2wmBRz0NYbQydZDlQo3e0qKapLN_PxR0JaeRdYG2EKgaAinYEALw_wcB +9JfzoLxqWWh0VMjlzh2iN4o9N9w=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,336544926909,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIJUlRXhLBoV7FQGxzUImJr-sX4ZOTBhjwl1GlOjwGoQTlimOxJvRYaAhRDEALw_wcB +FCe/Na1OM7qFufFW4FR1+teYiuE=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,410613989703,2020-07-08,2121450128,EAIaIQobChMInsL6y8O96gIVCtZ3Ch2HGg9rEAAYASAAEgLZ8vD_BwE +uYVycfyzkaoFb/LnVirQGKZxsXo=,2020-10-06 22:13:09.490 UTC,p6zp17DVJVjAD3VAr1btVw==,105893862412,G+b561Y/O/hceLQhm/Cd6Q==,enabled,9935249271,OxmwNLwKZ4TSPAcwmWr3aQ==,paused,1,336544926909,2020-07-08,2121450128,EAIaIQobChMI3r6pruS96gIVC7wYCh19MQo-EAAYASAAEgJN1PD_BwE +rH3hAHzXJiMLDVR6uA0D8S+C3o0=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJbfLFLHq2HjPyspqfHnBKlQCfVcTUfl3XZEOTzjn8aWkF11W40eVAaAjS3EALw_wcB +mGzuj9v/WtViL8VLITZeGJf2WiY=,2020-10-06 22:13:09.204 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMImZOy8Yu-6gIVfMq7CB39cw8iEAEYASAAEgJ2mvD_BwE +GW2OjP72mzVGJFCqmxzk9keVP5Q=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMIoIa2--O96gIVFN7eCh3klgl4EAEYASAAEgLmP_D_BwE +Q/gGFUvktNC/CmUC819Qs21fTO0=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMI1_qxvPa96gIV0C_TCh3ojw0mEAEYASAAEgIUS_D_BwE ++Tp0TXX4ABg5v573FIhdPOrd4WU=,2020-10-06 22:13:08.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,492207998548,2020-07-08,2121450128,EAIaIQobChMIiPHasvW96gIVySMZCh2gJQV1EAEYASAAEgI2A_D_BwE +ruTdGynVMQ7om8Wcpw6xwILl1W4=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,2,332843419914,2020-07-08,2121450128,EAIaIQobChMIo96DxfK96gIVBJMYCh00JQluEAEYASAAEgJwXfD_BwE +vlvwhCO0gh5/BlFvAyTxybXMAC4=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIS7_z0Crn5l0zTLYjH8XKF9M53_GC7oMtMw2hEK75ybe1V3GZgxr4aAugVEALw_wcB +jvpVtQs1plo3j6UWLWW/Xwq1knU=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMI34uu2IK-6gIVnOS7CB1BoQCBEAEYASAAEgKsFPD_BwE +ywZK+X92xBhHNu2VuUDUCIxg4q8=,2020-10-06 22:13:09.204 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIje2i6J--6gIVjvJ3Ch2kdQyVEAEYASAAEgJSnvD_BwE +kZCZqnvyFU8hpj6fhULIi9UlLjE=,2020-10-06 22:13:08.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,492207998548,2020-07-08,2121450128,EAIaIQobChMI8p_Hnca96gIVpBCLCh1IeA5iEAEYASAAEgJKcfD_BwE +vpN2pKJnuEk6Obk/AHbH1MnvTVo=,2020-10-06 22:13:09.203 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIlsqFkuy96gIVVTTgCh2QFwJOEAEYASAAEgId9vD_BwE +eimVZpZb20xBjYJMy9/7h7JFJTw=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMI2aDojdS96gIVD8iyCh3QRghmEAEYASAAEgKRtPD_BwE +E1xUSo+xs/tqaRcEEBdAadKm7V8=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,EAIaIQobChMIxufatNq96gIVScy7CB0EHgTwEAEYASAAEgIecvD_BwE +wel4W4JvyuGIU6yjbJ8NavlGflk=,2020-10-06 22:13:09.202 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,1,332843419914,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLgZ6Z0kotatfgBMkHvrp6E5WAaeAUznTZV_Xm5_UyKrbEhWMV_iEEaAowFEALw_wcB +SMWu6uDsSHmLc1OwtCne0tfwRPg=,2020-10-06 22:13:09.412 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI-a6DxKK-6gIVAz6tBh30gg25EAAYASAAEgK6MPD_BwE +m5z+qQ7K8qWjsrZpe+/71mRwk9A=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI0N7Fie696gIVjYbACh1W4wovEAAYASADEgLAB_D_BwE +riMtJxsujsT3/LKbGYTmViFU1Oc=,2020-10-06 22:13:09.206 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL46kNN8_PPgPI-P2TDyJgLBxAFi5XncrTGKvMeWkVvHRFAq5XscZsaAhFtEALw_wcB +Wsp0szZJBJWoK+cYkGeAToFw88I=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIi5nU7oK-6gIVjx-tBh3XHwNWEAAYASAAEgI7nvD_BwE +ORZffDG24Xatkn/LsWVK95XmLCA=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIzfPP2_m96gIVWz2tBh3n7QkZEAAYASABEgKIlfD_BwE +nILqpn+aCTOyOTaE3pl7kHfThaA=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIzJjf44i-6gIViITICh3nUA5XEAAYASAAEgIKnPD_BwE +iZaTJ2TJrp1tckQ6PwaOAT0yHRk=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJI6-s0I1NQdtC3Hrs-DBjuBHYiKqGY3ZeM8R0qX_FKOhdUlVKQ5ygaAm57EALw_wcB +H++ypyyGdmKr5aBKnd1DZRgl4p0=,2020-10-06 22:13:09.412 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKKN941dfP0cx9_u-X27YwMgonDHoMxfRKTb_Z6euYNL_DD2aLI7CMaAg9xEALw_wcB +HBQ338fj+DXo6pue9wt/++SR6hk=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZK5WsyhWALdrFqKcA3LDyNjIBsTVBcRPwSnLtD_HHUPiYZabxrMkWgaAv4UEALw_wcB +H4KXOwf4wex4Cp/1E8ALZJYEYhI=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIlpHUxaC-6gIVS7LICh0APgl7EAAYASAAEgJUc_D_BwE +ZXCR0xR6uTGuUgapYsv8hC4Qids=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIqqPykpy_6gIVdh-tBh2RwwxWEAAYASAAEgIujvD_BwE +TKLou8i8dNYVxDHQTGEce4HvpeY=,2020-10-06 22:13:09.404 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIi5nU7oK-6gIVjx-tBh3XHwNWEAAYASABEgJE8PD_BwE +Of7QlppKk+T6zficLCBO38wwXv0=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,EAIaIQobChMIvYjRzv696gIVEQnnCh0QEgNWEAAYASABEgIfdfD_BwE +BZiwpdbiV3Kaq58XHwkkaP3bOGk=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKVjUNzguVOR0PpmGGGHceSemWEKr_tWD1DzvFhCjqPBLEsxS6JEBwaAtz2EALw_wcB +jJhMn8NgQXPYBRg+lCf8Tmop1lc=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIh62lmua96gIVjcDACh3ARQuTEAAYASAAEgJ7B_D_BwE +GA3RExUwPMoy6yVyCmvCbyg/vdk=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIqPmw26O_6gIV7D6tBh2cVwNtEAAYASAAEgJQDvD_BwE +KvFjbMaXup3DaM9uZB6/GzqBIiU=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL_-SyEe9JHtqfqSqPZq6xlfsGa-CwMkJqaEJoNXdiJy7PY4yWmRLIaAtiBEALw_wcB +jFN294EqQkUHuPUOF3EIC2aPfaM=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKdRSxl8HqYVbq_1-T2QIA3Imn9hCpLwiFgEAKj5zd_MpQP05xDFGoaAmQ1EALw_wcB +i3SeFSKW+V/IPEe2tRBw3KvYSyY=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLLFvQP33bqbAU4pMwk4n9ynUOSrzShojRrd1tJWxGda8gQ_ZExacYaApESEALw_wcB +1It6hROez5/Szc7ncMFmdnwLjhw=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149592141,2020-07-08,2121450128,EAIaIQobChMIz9mwwJK_6gIVUtbACh2xxg2aEAAYASAAEgIIpPD_BwE +P0Iq4J+F5wx4dXVLH298NSTgwRI=,2020-10-06 22:13:09.409 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIurDk7pK-6gIVA9bACh2-lAxSEAAYASAAEgJMAPD_BwE +ToTKtf/dvRT6WFD0tkVIMbnHU8w=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJ1YIVsE8sjrkKT6ju5Ik5ybb7f3Uyjt1ufSsljXLej3JW4sSfZOZcaAssHEALw_wcB +QcYZnMhG1XSvcow7Z2zWXaHy514=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIpuCYm6u_6gIVT_DACh28yAReEAAYASAAEgJETvD_BwE +WGo+XxQrgNkVvps9Yh/NI9J7Oak=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI4OmPhaK-6gIVB7bICh0IcQ6rEAAYASAAEgJrT_D_BwE +6mEEx3ewUAYy3xsTHL+uDtYcdFI=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLmfarLDVkzrgS6mZw7Sma37KeB1NgAewyLGst0Lw-Ejd3RON2tsJ8aArsgEALw_wcB +Ju9VcCB85qpYHGiiHtf7/VgyOB4=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIlpHUxaC-6gIVS7LICh0APgl7EAAYASABEgJhKfD_BwE +Y51In/kEL+I0Q3Yg0edw6zwlEdI=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLp40eStu52LtDNtgIdFtiyluZ0ZXb9bkujnhOBUvECdf__HgsSEiMaAjY4EALw_wcB +ggsdMhIk9Ev9YtoLhPFu1ymHN30=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI1NbOkpm-6gIVhcDACh1GGgqKEAAYASAAEgK4t_D_BwE +Wzi+6qkvn60Vu3FIFkfRhzyvYXQ=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIltz3k5G96gIVi4bACh10VAzTEAAYASAAEgIsafD_BwE +CoQoQFce2OH3zvOZ9XFcB3fhYok=,2020-10-06 22:13:09.408 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIwbyp2pG-6gIVCbSzCh3McQsyEAAYASAAEgJaQfD_BwE +DVyE2D9PPgZ4AnHltCqT9nSq+dE=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIyIOuo5u-6gIVC77ACh1ZVgSPEAAYASAAEgLAePD_BwE +7Sjx0A0F/O9d0fJli8sqhi7U93c=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKIviwuqhh2jn5IEtAH50vOuEpJP3ufNH7QT10FOY9jIk5UipuBIgkaAhC3EALw_wcB +5a9FxrrHkCiZvAHhbGFZtbNWWLo=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMI-tjlpKa_6gIVsCCtBh1tmQqoEAAYASAAEgKmjPD_BwE +z0LdOnlb9k6uCJn3h3tbt+UnKwE=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIHg-ChW4_Jyiuy_OyDFIksRLaBQQiFnBjlUm3RyLCLqN0pK6X7YboaApuZEALw_wcB +F1DCTlZpYgRf3QnG8yTTkPEmf8k=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZI_-U8TO_xGAbA2VuGZtcaY80Xu8-h65l81IT-Tm73Wkc-lHL2KckMaAreyEALw_wcB +dGw4NZ0LgqaXLzWdRvnM2oRIQcU=,2020-10-06 22:13:09.409 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMIrduVy5K-6gIV7D6tBh0ieA2UEAAYASABEgLPOvD_BwE +1FqBVw0HeV1oIhi5A/NWGxvdJuk=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMIoYvu9qC-6gIViZ-zCh0mgANhEAAYASAAEgIaBvD_BwE +78BN0J+z0GU5y0aOwuhkCQhq494=,2020-10-06 22:13:09.407 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIr4LQv4y-6gIVvj2tBh3wGQmAEAAYASAAEgIEYvD_BwE +bxV2FXJbvV6gsRJvotU9Ecmlxm8=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLrrO0UwcYkDOuE5YCR8P5852rCOS9WUp00dTmFfCc50zE6BVITWtUaApbTEALw_wcB +cWGMyEK6WW2EKkR626uL+oLo9jo=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZL4pbAafo4T6A69KDO-_BmQNGIIFS3L4YMvTkn0KBBfcqXDeeiA0DUaAlDdEALw_wcB +pSCY7vOrUZHisRGAUZjemn0YG9Y=,2020-10-06 22:13:09.398 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZK2Bihj4ZDtkoDlTQ09WR3OyNLl-lTe3G5n78fv9sjclCd4m1fTpUMaAhqdEALw_wcB +6rdroM9Zvdr/yoISn/5NOGusdYs=,2020-10-06 22:13:09.207 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149592141,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLNxFC_xPrnSm60CjDYlfWiZgK6hJpA5RpAlaI-Z7-Oo6yZXmOPP0caAstFEALw_wcB +LrWXJRAhWucreoXCj1YfN5dQ26g=,2020-10-06 22:13:09.205 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI47nW_-696gIVCYTICh2W2QkLEAAYASABEgI76fD_BwE +ynjajCIZDk+q1gRH86VqmKYFDzc=,2020-10-06 22:13:09.411 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMI5cufnZ2-6gIV3QiICR1MCQm9EAAYASAAEgJqafD_BwE +H+/XUZ2+0Fl0qgZGvr4WxitDcqg=,2020-10-06 22:13:09.400 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJbZmBFwVyEnPqG3jljaQj1fPG2AU3GsX1nVQA96b2PrVb1k8XcJYMaAu4KEALw_wcB +nkRfaw8OokLfE4bIjZXDpYa8s50=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLlZU0WsTVvZqR6Ix-f8xvFsbSuOry-sCqKt3TghaseRJWQjk3U6SkaAmWfEALw_wcB +K/rUvMOmUp/MakpG7dpomxHcKtU=,2020-10-06 22:13:09.399 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMI0djVvdS96gIVD77ACh3TpwvzEAAYASAAEgJymvD_BwE +h484V/IiG+FBfzSnDIIUC4JL634=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIoZezurO_6gIVzz2tBh3-MQneEAAYASAAEgIuFfD_BwE +1ELqmNmwgq0JcyhltypaxswZp0s=,2020-10-06 22:13:09.414 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,166149589501,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJKsbQz9TxgUEhRogYI08-8hejoywWjUo3T_kiogX_exM8E3Bs3kMwaAnioEALw_wcB +xRcesxdin3xLoll0MALwq0zt5Qk=,2020-10-06 22:13:09.405 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIxabntgqiWNwjzQ_xxyXgbYLiCSK13aKtAcgMTbU8mS_Pl7NHwmVAaAln7EALw_wcB +IrKj+pDgOHDmTrIEYo2U1cMbNDk=,2020-10-06 22:13:09.402 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175231962493,2020-07-08,2121450128,EAIaIQobChMI7vLKhvq96gIVDQiICR1iMg_UEAAYASABEgJ7IfD_BwE +F9sMaIb0PotH6TlrpKDWynmS5+k=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIE-fuhioCFsX9UmGTlFjwfXw9Pde3vPrhILdesPd_5CC0RXJOTn7IaAvqcEALw_wcB +SfSD/lV2d9sHBpTUaqcWxtiUsO8=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZJv55bs89NM64tBN4XGSNZ_-DWtGyFbl52YYcPfCjOogqLjDjsEaH8aAn9AEALw_wcB +eE3JJqqQoIFygYsLg8p++ey2R1U=,2020-10-06 22:13:09.206 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,175227036493,2020-07-08,2121450128,EAIaIQobChMI293nqJ2-6gIVUD2tBh2uVQDlEAAYASAAEgJQg_D_BwE +wO3C313rEYMMqod4Dx1oAd4P9/0=,2020-10-06 22:13:09.413 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKELEgafWvQrfNmKKddGYFGwZBFB4ThEEG6xi8YxANJtSKizW3N6J8aAjU3EALw_wcB +jxeR5li02ZarnSLolAr4IwD6H6c=,2020-10-06 22:13:09.410 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIusbQ6pa-6gIVFqSzCh1qDAW3EAAYASAAEgI8WfD_BwE +dHpEIIqgfrRxr8jOMhS1WIkwujs=,2020-10-06 22:13:09.408 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,410613989703,2020-07-08,2121450128,EAIaIQobChMI1cjB85C-6gIVz8DACh2GDQLBEAAYASAAEgIXmfD_BwE +yAi9zArMPUJ/ej+dxPba20xOV6U=,2020-10-06 22:13:09.404 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKI9ccpuAyRKQdKmA5pxo-HKAw9vm6jQhCHeqSYkxDjKgIpe2SW8dUaAif8EALw_wcB +fh8x1EyYl9JS2XVY7o9cIghuB/w=,2020-10-06 22:13:09.403 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,EAIaIQobChMIsIOhwYC-6gIVVh6tBh2WMQBdEAAYASAAEgLMtfD_BwE +vs7+QziQq3kuwwen7FUE1Ls9E44=,2020-10-06 22:13:09.415 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLMqIvT7zRklc69kKdlwEPVjzn401-4R74lVaAeresg_S3zrVdwpdQaAnvUEALw_wcB +9GER+Pwzm9Ow9xQ5RMOnE575Gbc=,2020-10-06 22:13:09.401 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,59284563270,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLe35dQZpVmpuuVJ0lAXSFySlb5Krr1x9ZJUt3twCesZ5eV4UEUlMMaAhRDEALw_wcB +3Ufx+3mfvBA3Zyx3Y8wjaqfmP1M=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMIxK2fk6a96gIV2uJ3Ch0tAA0XEAAYASACEgIO5_D_BwE +xznELOg1Hz3LY0P+BpDL3CQsHTE=,2020-10-06 22:13:11.096 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMI_vGOkbu96gIVkuF3Ch3RxAgBEAAYASAAEgKaufD_BwE +jeXl7MK94rWv26G274yXLJVcV1w=,2020-10-06 22:13:11.102 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMI7tii_IW-6gIVzOeyCh2ZegwdEAAYASAAEgIXVPD_BwE +fV+zFKVZRCclVV2ksmt2EwMh17I=,2020-10-06 22:13:11.103 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZKPd-xKdOQ-llv9L6ktLQO4SdpPhURvjcMkyn9RwNMMfyBGI7cUiBUaAqVHEALw_wcB +o1w1X7WTJPO0NXR0AHeCaEdKBmw=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIr7GFKKq-TtMtQALqS0oK86hsT88oObF4su6GXnNdZKGtJv35hp5YaAta5EALw_wcB ++i5KkNPUbiFLkTup0IrIpILGRQs=,2020-10-06 22:13:11.102 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIIWeuwJzb7Hq3sKeu0UeCzoNMiWrRDebK_peXgC9tVJLMZPPrswpUaAkbGEALw_wcB +HNsOKIHXRZac6XBHyv1Tz4bdKaY=,2020-10-06 22:13:11.100 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,2,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIJcuKv3yE_UQ26DA6sEF683eLI5M0ZYwtKgbpPRRiemW7d7pWef74aAiTvEALw_wcB +CaH/TwkgwkDtQHsqtx1vuDR54zE=,2020-10-06 22:13:11.104 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMIl_rfyby_6gIVkql3Ch2oiQBFEAAYASAAEgJc6vD_BwE +RvgD8Ov2oqxPTA0B1fdrk8bElXc=,2020-10-06 22:13:11.103 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZInIKMCyuodFljmvQOWJXKkJbFE4IfmTf_GK8rMWz6Ap0jDrYlLXq0aAoa-EALw_wcB +SG/xQ37foid74/bpIGZUO+1PxT8=,2020-10-06 22:13:11.101 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLwa_kyJ-R82Oc3t8gZFk8flHc99wI18vMTo1OCcDXydihsh3w7Va8aAkTOEALw_wcB +SIqKPQIrm3Nah6BapFdHTJpbhHw=,2020-10-06 22:13:11.099 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,EAIaIQobChMIwZfzv-u96gIVWYXVCh0eSwe6EAAYASAAEgJWrvD_BwE +8SdJHBG7lqr+leOyVZyTtm6Ptv4=,2020-10-06 22:13:10.431 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,387293813655,2020-07-08,2121450128,EAIaIQobChMIs-iM95u96gIVAuDtCh23VQyIEAAYASAAEgLzxfD_BwE +iLb9XsycnJhdChNr/s+MfToUuuM=,2020-10-06 22:13:11.097 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,EAIaIQobChMIgLvNsb-96gIVxOR3Ch2wjgJYEAAYASAAEgI1tvD_BwE +TX3V98uPvfNHihyVjTeWmjr2Hoc=,2020-10-06 22:13:11.099 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZIMdbb_eYG0rs9aPZhlzUd9D48Lyxiv44TkzVDr8lPmkX4aQ_nceWcaAorgEALw_wcB +SacRo6goy4prP6RCHmdPc+KgPCE=,2020-10-06 22:13:11.095 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,71669451,2020-07-08,2121450128,Cj0KCQjw3ZX4BRDmARIsAFYh7ZLdUD0ewZuzm5EZAwFtnGUm5UtOK2eeMdeK_VioS2yqW64VirhnUIwaAu7dEALw_wcB +KHxYOjOpbHHCGWCLSdX+4xcTwz4=,2020-10-06 22:13:10.431 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,916298298903,2020-07-08,2121450128,EAIaIQobChMIn76W76296gIVFOh3Ch3ZKwwvEAAYASAAEgIyN_D_BwE +I+cICapUPHnvLVz9cgFrTT6YSPU=,2020-10-06 22:13:11.100 UTC,p6zp17DVJVjAD3VAr1btVw==,101951711506,bYq4SJQTdWsa9r2ra4CGPg==,enabled,10265563821,xdqJYlTJQHwUW7w9Xmzq/g==,enabled,1,323558771746,2020-07-08,2121450128,EAIaIQobChMItMeI7vC96gIVDdOyCh2GPQNMEAAYASAAEgKt7PD_BwE diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_criteria_performance_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_criteria_performance_data.csv new file mode 100644 index 0000000..76540b1 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_criteria_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,cost,criteria,criteria_destination_url,criteria_type,date,external_customer_id,id,impressions +EoTsmOaUS75SUc+Z65Sg/mQlWDw=,2020-10-06 22:16:20.560 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-14,2121450128,1705907456,45 +hCgjxps1PhouWaYDn4y+BBYoeJc=,2020-10-06 22:16:20.561 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-16,2121450128,1705907456,33 +CNgESh9K2FLhFZOiKVIX1LOV2pc=,2020-10-06 22:16:20.544 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-13,2121450128,1705907456,27 +UZ+eznARIcS37lf/6Ay8zp2ky3w=,2020-10-06 22:16:20.561 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-15,2121450128,1705907456,123 +3MY0Q+vLeIe39bK/qBA3Ps7SRxc=,2020-10-06 22:16:20.559 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-12,2121450128,1705907456,46 +V3rf4nBMuer+hTlHRMx06SK7VeM=,2020-10-06 22:16:20.543 UTC,p6zp17DVJVjAD3VAr1btVw==,23262140293,nw7JdebvUNCtWFk29hOYzw==,enabled,343270573,uvNLcekuVlV/pkwz0A1s4A==,paused,0,0.0,salesforce data integration,,Keyword,2016-03-11,2121450128,1705907456,7 +4rjICHkxAvLlj+BXBo6AnahxtU0=,2020-10-06 22:17:07.009 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,12.35,+bigquery +postgres,,Keyword,2019-12-05,2121450128,1030451960832,7 +iS2AhmTgMhAHD3kQLbN5hTKAjxI=,2020-10-06 22:17:07.040 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-12,2121450128,1030451960832,15 +JvjcOBIv7nPgzXLnUCj/8VuBCvM=,2020-10-06 22:17:08.021 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-31,2121450128,1030451960832,10 +W7jh6ttbfXnGx4SuJqBIrsqb7vg=,2020-10-06 22:17:06.846 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-21,2121450128,1030451960832,18 +AOo5iO9hafCXcSG2UrZFRVtAiVc=,2020-10-06 22:17:08.044 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-30,2121450128,1030451960832,6 +QW97keCFw4NqBjQhNhMXqw1hi1g=,2020-10-06 22:17:07.006 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-03,2121450128,1030451960832,12 +C1i+t4zd+Gt2aEv2tvyt7OncSWs=,2020-10-06 22:17:07.002 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-01,2121450128,1030451960832,5 +R51NBeR4Z6RkDCEqIeX2G1G+ikY=,2020-10-06 22:17:07.994 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-21,2121450128,1030451960832,2 +RQP7r5YjpcLMIuM6DIZ/Ws+2MTU=,2020-10-06 22:17:07.971 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-19,2121450128,1030451960832,9 +HfHagX6uRl2IURWWrs0uGr+YysQ=,2020-10-06 22:17:08.005 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-24,2121450128,1030451960832,8 +Jn+Zh34Hq9EDpEkMwr0ue6SKqYc=,2020-10-06 22:17:07.050 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-07,2121450128,1030451960832,4 +Pyc0iF+t4Hho4RRbvoo/53TllNs=,2020-10-06 22:17:06.845 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-20,2121450128,1030451960832,14 +cIOCRURlZKe6BD9IGlyX1ToNyXI=,2020-10-06 22:17:07.051 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-08,2121450128,1030451960832,8 +YSIDmsXXDY9d9BKYlaFMVfrES78=,2020-10-06 22:17:06.999 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-28,2121450128,1030451960832,2 +A6x7FPWdLthfG0J1OQ/oTsqcKyM=,2020-10-06 22:17:07.041 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-13,2121450128,1030451960832,26 +KG3x/z7sdAlFGxiWfIFB9iP1NA0=,2020-10-06 22:17:08.012 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-28,2121450128,1030451960832,8 +b//0BRE4NYPrlvh9sSBCtd3ls3o=,2020-10-06 22:17:08.086 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-12,2121450128,1030451960832,2 +VhmkeHFxpNvjNwluy3iFA/gFk6M=,2020-10-06 22:17:06.867 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-27,2121450128,1030451960832,13 +FQpyqZk8k6anIHPjNGMmUBcIKl0=,2020-10-06 22:17:07.042 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-14,2121450128,1030451960832,4 +za6J1an8gsmKTmfdspMabQJYL8I=,2020-10-06 22:17:07.072 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-16,2121450128,1030451960832,18 +vEJO2FJoy43oe5Gl3h4EzCcUPc0=,2020-10-06 22:17:08.088 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-13,2121450128,1030451960832,10 +gs2GaSm8ONQMqI+h1PMDWX3gOY4=,2020-10-06 22:17:06.978 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-02,2121450128,1030451960832,6 +KJOs5Cmbi9KeQoKoku8u3EMkpYE=,2020-10-06 22:17:06.856 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-24,2121450128,1030451960832,6 +2v//zWlwswM9odEg0EcDVxmo2Rg=,2020-10-06 22:17:08.004 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,11.85,+bigquery +postgres,,Keyword,2019-12-23,2121450128,1030451960832,11 +5ccM8c0HnSCliZ9G+bk7RI4tcc4=,2020-10-06 22:17:07.061 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,12.14,+bigquery +postgres,,Keyword,2019-12-11,2121450128,1030451960832,38 +b+jr1S/r9EMYRg0n/nwSMac5gZ4=,2020-10-06 22:17:07.976 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-22,2121450128,1030451960832,5 +KeDvaNjk+/HFHB7yDihhJOT29w4=,2020-10-06 22:17:08.022 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-01,2121450128,1030451960832,1 +Fdnc/7MycXSHdoujKC3G8SpkEYo=,2020-10-06 22:17:08.976 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,1,11.81,+bigquery +postgres,,Keyword,2020-01-17,2121450128,1030451960832,21 +lzTKfqEC+UrP4+tVM0T/NKJawFQ=,2020-10-06 22:17:08.032 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-03,2121450128,1030451960832,6 +9H+kqHIaaAO8QvAh8k8l+5/87aI=,2020-10-06 22:17:07.973 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-20,2121450128,1030451960832,9 +kAyo2wfc6KqhQaoIy4zq7KmeRBI=,2020-10-06 22:17:08.095 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-14,2121450128,1030451960832,3 +qk/KRGOvClwHv2MsC8L5q4aNtTM=,2020-10-06 22:17:08.035 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-27,2121450128,1030451960832,6 +j3AYQiFvB/kDhyp9iqtXFJMltsA=,2020-10-06 22:17:08.099 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-06,2121450128,1030451960832,12 +JNxZUb138pKQfi0hdjQElROUmik=,2020-10-06 22:17:05.461 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-14,2121450128,1030451960832,1 +Sm2tG0phnJTWfpcS8Eas7bR+9n4=,2020-10-06 22:17:07.001 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-30,2121450128,1030451960832,1 +OxMIYkY+eOsH9ypZfCHlrul1/EY=,2020-10-06 22:17:06.855 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-23,2121450128,1030451960832,8 +P0dY5o8KoCYqv1QvKJknX/sXN/4=,2020-10-06 22:17:06.866 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-26,2121450128,1030451960832,6 +1tTV3EqY4TbwsFavurzKhusB+4s=,2020-10-06 22:17:06.853 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-22,2121450128,1030451960832,8 +p6yueZtkUD8yaHkJGK0FJIrE2qM=,2020-10-06 22:17:07.983 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-17,2121450128,1030451960832,10 +eYWJa5pMLbjw2zbWrtSauEKHjQk=,2020-10-06 22:17:07.018 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-06,2121450128,1030451960832,9 +eX5PIRrvXD9dRgGkzLZ/YflfoJc=,2020-10-06 22:17:06.833 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-18,2121450128,1030451960832,11 +gBMNzEsmvr2TKZxR/fTLNdknscw=,2020-10-06 22:17:08.098 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-15,2121450128,1030451960832,17 +HwS1nvMmtV1iht4ox4Fa5uFz7LU=,2020-10-06 22:17:06.989 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-04,2121450128,1030451960832,4 +Lalzxv/AUXQ9HMp3LMBxYBbLHYM=,2020-10-06 22:17:08.974 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-16,2121450128,1030451960832,9 +DqmjbkRl1mF9rUk7EOvBxYhppmI=,2020-10-06 22:17:08.978 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-18,2121450128,1030451960832,5 +5JzGipiOhFxCvjUvP++ImJ7jjxU=,2020-10-06 22:17:07 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-29,2121450128,1030451960832,5 +qGCx9Sx2Wl+i6YMHhHG3njDEX/M=,2020-10-06 22:17:08.024 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-02,2121450128,1030451960832,10 +ChAyW2hgkIKvh9Pe3LVlmPUqt4Q=,2020-10-06 22:17:08.106 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-07,2121450128,1030451960832,14 +11pmkAzdwpizcUXq+9OCAZfvSB0=,2020-10-06 22:17:08.110 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-09,2121450128,1030451960832,3 +wSz/tJLrQtoiybyP1CHhxVnZMZs=,2020-10-06 22:17:07.048 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-15,2121450128,1030451960832,1 +9RSw5WriEq3FH0w39OZP+8YnIDY=,2020-10-06 22:17:06.864 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-25,2121450128,1030451960832,19 +8BzBPV2Ap9vX5pOP75ey+pgYPb4=,2020-10-06 22:17:07.981 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-26,2121450128,1030451960832,6 +T5Ls06Ju7aSKpU5Q9S7RXt7XCEo=,2020-10-06 22:17:06.843 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-19,2121450128,1030451960832,27 +nBT+pseNR2wv/UoNVLGKORVgfIU=,2020-10-06 22:17:07.028 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-09,2121450128,1030451960832,21 +fEUNC5fzH6uy/jLi8DxYHyiGqoM=,2020-10-06 22:17:05.520 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-15,2121450128,1030451960832,2 +nEs5PNezROLC4W034tjW4XIcksQ=,2020-10-06 22:17:08.075 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-08,2121450128,1030451960832,14 +6hIs3Oeppk1AvTkYxttGuDB34QE=,2020-10-06 22:17:08.013 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-29,2121450128,1030451960832,3 +3UbbOcAEyghV4w+Lsx/UthLzWGE=,2020-10-06 22:17:06.831 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-11-17,2121450128,1030451960832,1 +m0LQBQeIgx3BR2nZH1sijETLwzg=,2020-10-06 22:17:08.007 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-25,2121450128,1030451960832,3 +/DSfNzJTqqpGwjmRlCY2SVplkt8=,2020-10-06 22:17:09 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-21,2121450128,1030451960832,7 +0wPOOGEWMWHimc1ZmhEWbWfF/Tg=,2020-10-06 22:17:08.997 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-20,2121450128,1030451960832,13 +WNMyMH69xGppRfQXp9RwULcR7l4=,2020-10-06 22:17:08.979 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-19,2121450128,1030451960832,3 +cF1v3vkSYwVRqo4FEaXGHrj9ccY=,2020-10-06 22:17:08.065 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-05,2121450128,1030451960832,1 +GLm8aqVzA/a1f7iuc8ONRILYtV4=,2020-10-06 22:17:08.079 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-10,2121450128,1030451960832,19 +O4NhF2GM1XI0YUInliBkZ1YfwDo=,2020-10-06 22:17:07.984 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-18,2121450128,1030451960832,12 +31eg9eWQHpe/97O4J/478SeTxik=,2020-10-06 22:17:07.054 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2019-12-10,2121450128,1030451960832,11 +si7iwWqfasw7oM71Gb8GoEA7/T0=,2020-10-06 22:17:09.001 UTC,p6zp17DVJVjAD3VAr1btVw==,81959351923,0PtFig7zfPrcJi0rxwngtQ==,enabled,7946228124,XWTeU+j9uHJth0ZgAF+U/A==,paused,0,0.0,+bigquery +postgres,,Keyword,2020-01-22,2121450128,1030451960832,9 +UJbXBkMdVET/UIEs91VZwNGkrI0=,2020-11-06 14:21:38.458 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-12,2121450128,930331198976,1 +VX3OxXsdb2tcfymtpuXuo3QORVY=,2020-11-06 20:21:00.955 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-04,2121450128,930331198976,1 +HazDNaz3z/tCjXyh2M9FxTL0rc0=,2020-11-05 14:21:48.625 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-06,2121450128,930331198976,1 +APOQ7umVb3klaq7W9pLB0mYT6t8=,2020-11-06 14:21:39.219 UTC,p6zp17DVJVjAD3VAr1btVw==,118565598228,AcZ/rqg//Vlf59iMGAYiaA==,enabled,11226416637,S0hOogbA00TYwHnFl1NVuw==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-23,2121450128,930331198976,1 +VXipp1OrgkpC8UUZ969wmKl/wbU=,2020-10-11 14:21:17.574 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-11,2121450128,930331198976,2 +iKIZeDU6l4iWvGyIwLeWsQHHx6k=,2020-11-06 14:21:39.631 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-29,2121450128,930331198976,1 +6vkm3xTQXj+YnWDYcxjwN86JpYw=,2020-10-24 14:21:13.759 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-24,2121450128,930331198976,3 +YwGARDsvJ8zQwKlkVcuwoE4F44k=,2020-10-12 14:21:17.606 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-12,2121450128,930331198976,2 +PodzW5f+VT7XsRLmgZeWmvd1SlM=,2020-10-31 14:21:28.326 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-01,2121450128,930331198976,2 +sljqvnsmFo5Xr6/v2Azw2qz94T8=,2020-10-09 14:21:19.108 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-09,2121450128,930331198976,1 +Y6L+tLfEg7ugcGMgNRo23Iveg9s=,2020-11-06 14:21:39.043 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-20,2121450128,930331198976,1 +EJYYtKPXFLMqm66CR0zZqGWgZgk=,2020-10-06 22:17:18.969 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-31,2121450128,930331198976,1 +XMY/jEg8ysxEt7otmvGL+OrvMeI=,2020-10-06 22:17:18.704 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-24,2121450128,930331198976,2 +Yq3UBsiFy5UjLNhxFkcZaLvbqT8=,2020-10-14 14:21:22.003 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-14,2121450128,930331198976,1 +LfeYvMpSk8oOB1lpKYfG1oQ6pfs=,2020-11-06 14:21:39.751 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-02,2121450128,930331198976,1 +U24D3yjWA24uoXOcvoPP17K1sdg=,2020-10-23 14:21:05.249 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-23,2121450128,930331198976,1 +IwV6C9f4gxwL1PBQN52y3fz5hWs=,2020-10-08 14:21:33.606 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-09-08,2121450128,930331198976,2 +Fkqnnf9KN10gWGM9HnrJqStWx00=,2020-11-06 14:21:38.162 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-12,2121450128,930331198976,3 +bcIo090y4HHe1OjJ/SAOcW1ZZtI=,2020-11-06 20:21:01.239 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-11-05,2121450128,930331198976,2 +QjIK40It78uW7HQNglvM8nWSeTw=,2020-11-04 14:21:12.843 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,9.38,+fivetran +braze,,Keyword,2020-10-05,2121450128,930331198976,4 +6mRcJ1UMU8Yo/UWP/ucYVoU7a3k=,2020-10-06 22:17:18.829 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-28,2121450128,930331198976,2 +D/FDdl8QMnhXHlT7x4i9U7oOUEc=,2020-10-06 22:17:18.765 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-25,2121450128,930331198976,5 +mze24+dC9BR4FroYvCNuSVZAEgU=,2020-11-06 14:21:39.437 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-27,2121450128,930331198976,1 +0XE7Gxs1vyg5Yg74LyYtifNxYh8=,2020-11-06 20:21:01.318 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,3.16,+fivetran +braze,,Keyword,2020-11-06,2121450128,930331198976,3 +mK1FQRRpJNcunORjEjFBSp5BGa4=,2020-10-06 22:17:18.688 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-08-23,2121450128,930331198976,1 +hinrqfo2Z/PydqCqGvK/Ufcp7Lc=,2020-11-06 14:21:38.717 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,1,1.47,+fivetran +braze,,Keyword,2020-10-15,2121450128,930331198976,1 +kldjG3KPWf2d2dUBXXfaQ2gFTek=,2020-11-06 14:21:39.314 UTC,p6zp17DVJVjAD3VAr1btVw==,105252249986,AcZ/rqg//Vlf59iMGAYiaA==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,0,0.0,+fivetran +braze,,Keyword,2020-10-23,2121450128,930331198976,1 diff --git a/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_final_url_performance_data.csv b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_final_url_performance_data.csv new file mode 100644 index 0000000..6c05f98 --- /dev/null +++ b/dbt_packages/google_ads_source/integration_tests/seeds/google_ads_final_url_performance_data.csv @@ -0,0 +1,101 @@ +_fivetran_id,_fivetran_synced,account_descriptive_name,ad_group_id,ad_group_name,ad_group_status,campaign_id,campaign_name,campaign_status,clicks,cost,date,effective_final_url,external_customer_id,impressions +t0DPvJZPXc0dEeRXzvW1Ws630Kg=,2020-11-06 14:21:38.048 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,14,64.46,2020-10-08,https://fivetran.com/,2121450128,58 +ejSkj6uwxNeyDj1MTYLOevYKfhM=,2020-11-06 14:21:38.309 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,21,105.14,2020-10-20,https://fivetran.com/,2121450128,61 +ithyLOIIhpXy5UH+fNrXzzdQkWk=,2020-11-06 14:21:38.346 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,13,59.62,2020-10-21,https://fivetran.com/,2121450128,68 +rgAreBQ1/9AGgXLw/euz7Z6dr6U=,2020-11-06 14:21:38.215 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,14,65.67,2020-10-16,https://fivetran.com/,2121450128,48 +SMdF02iwFmyYbBKhcetY736a6qM=,2020-11-06 14:21:38.194 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,17,78.33,2020-10-15,https://fivetran.com/,2121450128,60 +k7SyAJ3iMCPOOuHLq+0sRyVwjNY=,2020-11-01 14:21:41.500 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,17,72.38,2020-10-02,https://fivetran.com/,2121450128,49 +i2JkG9GTlrYDSgZ4J5IgYKIskNs=,2020-11-06 14:21:38.575 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,111.58,2020-10-29,https://fivetran.com/,2121450128,74 +FAVTl0sD4TIyJyCP+prU5GJj3Pw=,2020-11-06 20:21:00.925 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,13,70.08,2020-11-06,https://fivetran.com/,2121450128,49 +5nxDcoA1OdaIqJinxY/8DsecrIY=,2020-11-06 14:21:38.291 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,87.67,2020-10-19,https://fivetran.com/,2121450128,75 +KYPsLyfw2jYzs/QhP9lpOTIppfg=,2020-11-06 20:21:00.954 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,15,85.4,2020-11-05,https://fivetran.com/,2121450128,47 +n37rkdOOY4goe+jUs1h+N6c1g6I=,2020-11-06 14:21:38.559 UTC,p6zp17DVJVjAD3VAr1btVw==,109772519425,G+b561Y/O/hceLQhm/Cd6Q==,enabled,11254717906,qbWrdqrzPioKTOj3tS+6cQ==,enabled,19,118.6,2020-10-27,https://fivetran.com/,2121450128,76 +wsIKp1H7kdlc7J8errgdME/rYU4=,2020-10-06 22:17:29.115 UTC,p6zp17DVJVjAD3VAr1btVw==,104918891267,Dgdx4cvumsqzPS0LFplOjQ==,enabled,10204071965,Bg4wdiKgpaGR7QNEBl6tow==,paused,13,7.363337,2020-06-06,https://fivetran.com/signup,2121450128,288 +TZqftZZ0ezKu9gRCfS5ubwD1x5o=,2020-10-06 22:17:27.885 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,110,12.539943,2020-05-14,https://fivetran.com/signup,2121450128,19205 +3VZnjszL0jPIzywjmKcSd0SBUpo=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,83,13.263128,2020-05-16,https://fivetran.com/signup,2121450128,12822 +LEoFuxsykXnNIS1qdseugWgqWes=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,147,17.806708,2020-06-05,https://fivetran.com/signup,2121450128,20231 +ZdQa2bk1yfHC74rLV9T+L3EIcM0=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,140,13.137977,2020-05-22,https://get.fivetran.com/demo,2121450128,30956 +TbPhTKNiM/vydc3EX8WYV3qE+bE=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,126,10.169802,2020-05-17,https://fivetran.com/signup,2121450128,17513 +RfIObZXowXEUP5M7J1UY6A3IsT4=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,100,16.643208,2020-05-15,https://fivetran.com/signup,2121450128,18417 +hgPgjbA9EDmc6NTQrZj8tXcZKfY=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,152,13.250064,2020-05-18,https://fivetran.com/signup,2121450128,11488 +ENGmiWQ69CG1mo239/82kpFj/74=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,66,7.849638,2020-05-30,https://fivetran.com/signup,2121450128,5172 +PmBdD3C0Z4I4wadodfVl8RfV5j8=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,210,29.947659,2020-05-24,https://fivetran.com/signup,2121450128,19768 +K/ZoJBB9LkJ8SSUhrl14HhhmnWw=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,132,18.748165,2020-05-25,https://fivetran.com/signup,2121450128,14069 +L/MsqYf1sHoojNOeSwgHlDPutsc=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,108,11.012773,2020-06-03,https://fivetran.com/signup,2121450128,6908 +EiK6BeUczKWlL10zjSb89q3lCd0=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,142,9.671773,2020-05-19,https://fivetran.com/signup,2121450128,6198 ++okCr+2/LLMpYRMBxgo7B0gEMs4=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,180,7.875836,2020-05-21,https://get.fivetran.com/demo,2121450128,32030 +Gs42eEiAEQQLzrg10y/oGcrBazM=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,169,9.881831,2020-05-21,https://fivetran.com/signup,2121450128,32166 +VJAWpLazVJ7SbF9nOx9cClog1kc=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,81,9.359642,2020-06-02,https://fivetran.com/signup,2121450128,5876 +BIHVYPao1Voga6RgGap9gDVbbck=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,124,23.094801,2020-05-28,https://fivetran.com/signup,2121450128,24506 +z5bCjczmoANz46XsYFsCy/vFgeo=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,77,8.64865,2020-06-01,https://fivetran.com/signup,2121450128,5146 +EQnKPZ0t4kdvu9MUsfRQR7ugNWA=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,38,4.344248,2020-06-10,https://fivetran.com/signup,2121450128,1989 +kJ5kT9/EiOsMHqhwNPkfr9JcOeE=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,13,0.884615,2020-05-25,https://get.fivetran.com/demo,2121450128,5018 +M/JdDV2dvc2SeEkOm4LoKg/OSOo=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,160,13.858554,2020-05-22,https://fivetran.com/signup,2121450128,27639 +dh/J6LWOy2zmainTEWBCey6t3oI=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,22,1.374976,2020-05-24,https://get.fivetran.com/demo,2121450128,9800 +eCRJjS0B7MkQtBojFr+ucuuzZCE=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,125,15.057942,2020-06-06,https://fivetran.com/signup,2121450128,10450 +ZAqneAQ0q0RlTeKHHvdaQXu062w=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,127,19.477663,2020-05-31,https://fivetran.com/signup,2121450128,7896 +F2IczjeiisqckTIcgGxRfGmpQeY=,2020-10-06 22:17:29.164 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,278,30.229589,2020-06-08,https://fivetran.com/signup,2121450128,14067 +agp+oV5ayhGsb/eAS8L6Yl4I1rM=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,42,3.502521,2020-05-27,https://fivetran.com/signup,2121450128,3060 +b0i/YFpkh1r43dzHo4NaB5+v/ik=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,170,8.900929,2020-05-20,https://fivetran.com/signup,2121450128,3440 +MtionUIOXGZ4SzWEzD4t7x7K4Io=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,141,16.827692,2020-06-09,https://fivetran.com/signup,2121450128,4941 +R9q4+tVutvtfdOqFZnvxTiqBR9M=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,113,15.452109,2020-06-07,https://fivetran.com/signup,2121450128,7776 +yiFWlibRn6+SPblJ+pcLlJnf9pw=,2020-10-06 22:17:29.163 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,129,18.835226,2020-05-26,https://fivetran.com/signup,2121450128,15402 +lrp3BgPEBlWpYNXPuyACD0Cp8nU=,2020-10-06 22:17:29.188 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,69,9.299847,2020-05-23,https://fivetran.com/signup,2121450128,8270 +3G99pZ/PgL5k01UhxufqMhIVjvM=,2020-10-06 22:17:29.189 UTC,p6zp17DVJVjAD3VAr1btVw==,104098978311,uW+f8HsyjSNAPwNIQq4tVg==,enabled,10074600702,yszyKz9EwZU5EyNgmNm8nw==,paused,113,20.253699,2020-05-29,https://fivetran.com/signup,2121450128,8071 +bMzsF8dFTVYU9RB87uwTJOeQljk=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,19,4.298416,2020-06-10,https://fivetran.com/signup,2121450128,191 +P63DDyaVvoALWxOMBuY73boL1WU=,2020-10-06 22:17:29.112 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,54,12.645893,2020-06-06,https://fivetran.com/signup,2121450128,513 +K+22OcUc/TYP7Gh2IqfP3nvaItg=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,26,8.986242,2020-06-04,https://fivetran.com/signup,2121450128,645 +ibH3UoETsjIywQz2niF9OWpKa0k=,2020-10-06 22:17:29.112 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,43,9.279726,2020-06-07,https://fivetran.com/signup,2121450128,465 +gbGJiEMtkQSs7sbXSlmZxI0piGM=,2020-10-06 22:17:29.129 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,128,37.36967,2020-06-08,https://fivetran.com/signup,2121450128,1804 +heSOb85T1t9LMOnLegfRQuPEnKg=,2020-10-06 22:17:29.129 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,102,26.172773,2020-06-09,https://fivetran.com/signup,2121450128,1413 +2BEeIV4Dh2rcUONpg+JI9Jr2Plc=,2020-10-06 22:17:29.201 UTC,p6zp17DVJVjAD3VAr1btVw==,104918890507,jsSdGF3Id1NPcoC6XIwTtA==,enabled,10204071830,asVRmjZ2l5NOpnWCHZdHXA==,paused,22,8.694242,2020-06-04,https://get.fivetran.com/demo,2121450128,255 +1+fkSic+5Ag/ZPAm/aGyBbN6SC4=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,36,5.118154,2020-05-28,https://fivetran.com/signup,2121450128,870 +Ff9K+HiXDNlVJgcq4b1Zlol0XrQ=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,46,6.609135,2020-05-24,https://fivetran.com/signup,2121450128,1135 +312vFl34U85rR+7xwgsEkLsignQ=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,48,6.555083,2020-06-07,https://fivetran.com/signup,2121450128,2211 +5pyaKAhy4b0bapsf+CNd7WHsmkM=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,53,8.40214,2020-06-06,https://fivetran.com/signup,2121450128,1871 +JHslbAPb3QqnM/6IsY6dFzoZkOE=,2020-10-06 22:17:30.485 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,14,4.539851,2020-06-17,https://fivetran.com/signup,2121450128,1821 +cJYeZxdRlOa3V5TaXZMfAzWtdvw=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,22,2.194164,2020-05-21,https://fivetran.com/signup,2121450128,579 +14DN50JwsW+2tzzw1GlDqZyhP3A=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,29,5.583538,2020-06-10,https://fivetran.com/signup,2121450128,2003 +Qo30up1d9RdBxTwM7pBZQ7Op3zQ=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,32,6.308484,2020-06-09,https://fivetran.com/signup,2121450128,1679 +Ogkpfw9NAZhiAbXdadsQLjA1cSY=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,45,4.373474,2020-05-26,https://fivetran.com/signup,2121450128,967 +/ukSwWJoxX9fP6U3FGUkA4Zmy8o=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,41,9.272221,2020-06-08,https://fivetran.com/signup,2121450128,2089 +nUDMKZYZITnXAp5660aTLqR1P0U=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,33,7.715897,2020-05-25,https://fivetran.com/signup,2121450128,686 +AaNfsrWtH2X0dVTTTD657xf9y70=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,13,2.335834,2020-05-25,https://get.fivetran.com/demo,2121450128,451 +x9QgybfvMYJHJsA+JzpOzknLt0M=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,29,3.716316,2020-05-22,https://fivetran.com/signup,2121450128,726 +8tXpg/A3zwY9IavbNsJgZYcIKfA=,2020-10-06 22:17:29.195 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,56,9.246693,2020-05-27,https://fivetran.com/signup,2121450128,1045 +Y653lvwyR2BbS2RqsSwFDKa2QH8=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,44,5.49378,2020-06-01,https://fivetran.com/signup,2121450128,881 +jKIaj2uiQPI/PhvsWVCC+U6MlkA=,2020-10-06 22:17:29.233 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,13,1.057608,2020-06-05,https://fivetran.com/signup,2121450128,922 +jqKgdE/GTvg22805haAG+CjKgOU=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,27,2.18607,2020-05-21,https://get.fivetran.com/demo,2121450128,631 +BDnqeKAMw78eronzdS5TjoL1Fa8=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,31,6.136347,2020-05-29,https://fivetran.com/signup,2121450128,690 +rudq0t44A0JVUqTroBpB90t2bsE=,2020-10-06 22:17:29.225 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,47,5.570398,2020-06-03,https://fivetran.com/signup,2121450128,627 +zEeViDf4yOQzMwoUnRGPhPb/EiI=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,14,7.863472,2020-05-30,https://fivetran.com/signup,2121450128,283 +7LTrU42E9xrfc0eGVomat6MJBOI=,2020-10-06 22:17:29.232 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,21,2.247402,2020-05-22,https://get.fivetran.com/demo,2121450128,744 +6TKsFQgyKjbfFeMKsOisqSnmpwE=,2020-10-06 22:17:29.206 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,23,3.460865,2020-05-24,https://get.fivetran.com/demo,2121450128,935 +6qLnEPKndBjAojdeWxyh5BlAXcs=,2020-10-06 22:17:29.207 UTC,p6zp17DVJVjAD3VAr1btVw==,105893866252,Dgdx4cvumsqzPS0LFplOjQ==,enabled,9935249436,2HSmdnmzKyboPGqqYnfvZQ==,paused,36,4.563421,2020-06-02,https://fivetran.com/signup,2121450128,374 +85EMFh++iU3F6kDeIii6TF688VM=,2020-10-06 22:16:53.887 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,9.85,2017-05-05,http://www.fivetran.com,2121450128,85 +efDGE+TVToI3WsWJdegyTzD9LzQ=,2020-10-06 22:17:14.724 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,17,49.56,2019-04-09,https://fivetran.com/demo,2121450128,199 +MknLKodiAmtKSAmLTtjlDZq3HJE=,2020-10-06 22:17:16.512 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,24,130.74,2019-06-10,https://fivetran.com/demo,2121450128,305 +aBf9mEfET+AVzujJus2JlUbsRHk=,2020-10-06 22:16:54.992 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,14,12.47,2017-06-13,https://fivetran.com/demo,2121450128,109 +rDxXCaDc1G07wrpG2/OMT9iCi+0=,2020-10-06 22:17:14.724 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,17,65.99,2019-04-08,https://fivetran.com/demo,2121450128,173 +14mN9iPuB/EIEzdtmovxTFBgmT8=,2020-10-06 22:17:13.650 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,15,64.48,2019-03-06,https://fivetran.com/demo,2121450128,130 +stsXQZpYjfXEcpgAGxWQ23U8XGY=,2020-10-06 22:17:14.740 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,61.38,2019-04-12,https://fivetran.com/demo,2121450128,138 +nJB2f1men7ADaaksyoyl8oWWf8Q=,2020-10-06 22:17:05.969 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,21,66.44,2018-06-07,https://fivetran.com/demo,2121450128,144 +jztW0Bg3++9ZZCZ2iR+eO/CXiRU=,2020-10-06 22:17:02.950 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,36.54,2018-02-15,https://fivetran.com/demo,2121450128,119 +99+nX/vq+5HfmdLSaCjwQDwjOeo=,2020-10-06 22:17:32.793 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,53,585.64,2020-08-24,https://fivetran.com/signup,2121450128,456 +MoQcvQ2+fE+OecQO1ZXDM3lnvuE=,2020-10-06 22:17:17.453 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,60,308.52,2019-07-08,https://get.fivetran.com/demo,2121450128,527 +Xn6k8b4ZOI4BbGkrNtdJIgSImnE=,2020-10-06 22:17:19.687 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,26,277.76,2019-08-28,https://get.fivetran.com/demo,2121450128,181 +MeQVJGD/wirQfbxyQCDGp4ObKvg=,2020-10-06 22:17:27.736 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,29,177.15,2020-04-28,https://get.fivetran.com/demo,2121450128,268 +VrSbUgnYQjdKsWzAa/VADbcGYG0=,2020-10-06 22:17:16.512 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,86.84,2019-05-22,https://get.fivetran.com/demo,2121450128,270 +FExymA9syq+hKbSHTsKU0G1821w=,2020-10-06 22:17:21.331 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,240.56,2019-10-20,https://get.fivetran.com/demo,2121450128,107 +j0xOj437KOehlyp0uNZI9QNLmLs=,2020-10-06 22:17:15.767 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,52.51,2019-05-03,https://get.fivetran.com/demo,2121450128,198 +y0uh0mUG+Hz4migzYC6UAHjXcWY=,2020-10-06 22:17:20.566 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,18,192.63,2019-10-07,https://get.fivetran.com/demo,2121450128,203 +9m1rZ0zKW+TWGcuqUF05cGP77Wc=,2020-10-06 22:17:09.273 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,15,91.35,2018-09-25,https://get.fivetran.com/demo,2121450128,200 +I0yWi/bzWk/bXyVzXEAZ11xUhRE=,2020-10-06 22:17:11.296 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,25,100.28,2018-12-05,https://get.fivetran.com/demo,2121450128,302 +PSpo33zOhnjcJepSFTsnRqOP7GU=,2020-10-06 22:17:20.566 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,33,400.0,2019-09-23,https://get.fivetran.com/demo,2121450128,420 +U2WA6BMhLEhrozxCWNvDGcaNn0I=,2020-10-06 22:17:22.152 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,53,252.26,2019-12-11,https://get.fivetran.com/demo,2121450128,555 +3EZlye3DDf505zhMROd15pgsAqk=,2020-10-06 22:17:09.273 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,16,74.32,2018-10-22,https://get.fivetran.com/demo,2121450128,175 +CAK6rDgrSeN7erqDXlRC6DNKsk8=,2020-10-06 22:17:11.297 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,46,176.85,2018-12-04,https://get.fivetran.com/demo,2121450128,479 +XQoO5jW+Nqh3GISHStLN8qxgHWA=,2020-11-05 14:21:47.952 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,65,553.92,2020-10-06,https://fivetran.com/signup?utm_source=google&utm_medium=cpc&utm_campaign=7011G000000QYFHQA4,2121450128,594 +8pSXTj920NcBaggPr0oNUbnPTWU=,2020-10-06 22:16:47.062 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,14.89,2016-10-05,http://www.fivetran.com,2121450128,72 +q+/rPsjAgoVyw5Ahv/TF9WUoEpw=,2020-10-06 22:17:02.950 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,13,34.69,2018-02-21,https://fivetran.com/demo,2121450128,109 +vO7+dxjy7pFP1xOVnx0iPGsE0Vk=,2020-10-06 22:17:01.203 UTC,p6zp17DVJVjAD3VAr1btVw==,23289504013,G+b561Y/O/hceLQhm/Cd6Q==,enabled,344106493,WLcyudjLopZCAwVCG42LtA==,enabled,14,27.33,2017-12-12,https://fivetran.com/demo,2121450128,155 diff --git a/dbt_packages/google_ads_source/macros/get_account_history_columns.sql b/dbt_packages/google_ads_source/macros/get_account_history_columns.sql new file mode 100644 index 0000000..f45ba96 --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_account_history_columns.sql @@ -0,0 +1,23 @@ +{% macro get_account_history_columns() %} + +{% set columns = [ + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "auto_tagging_enabled", "datatype": "boolean"}, + {"name": "currency_code", "datatype": dbt_utils.type_string()}, + {"name": "descriptive_name", "datatype": dbt_utils.type_string()}, + {"name": "final_url_suffix", "datatype": dbt_utils.type_string()}, + {"name": "hidden", "datatype": "boolean"}, + {"name": "id", "datatype": dbt_utils.type_int()}, + {"name": "manager", "datatype": "boolean"}, + {"name": "manager_customer_id", "datatype": dbt_utils.type_int()}, + {"name": "optimization_score", "datatype": dbt_utils.type_float()}, + {"name": "pay_per_conversion_eligibility_failure_reasons", "datatype": dbt_utils.type_string()}, + {"name": "test_account", "datatype": "boolean"}, + {"name": "time_zone", "datatype": dbt_utils.type_string()}, + {"name": "tracking_url_template", "datatype": dbt_utils.type_string()}, + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()} +] %} + +{{ return(columns) }} + +{% endmacro %} diff --git a/dbt_packages/google_ads_source/macros/get_ad_final_url_history_columns.sql b/dbt_packages/google_ads_source/macros/get_ad_final_url_history_columns.sql new file mode 100644 index 0000000..b5490c8 --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_ad_final_url_history_columns.sql @@ -0,0 +1,14 @@ +{% macro get_ad_final_url_history_columns() %} + +{% set columns = [ + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_id", "datatype": dbt_utils.type_int()}, + {"name": "sequence_id", "datatype": dbt_utils.type_int()}, + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, + {"name": "url", "datatype": dbt_utils.type_string()} +] %} + +{{ return(columns) }} + +{% endmacro %} diff --git a/dbt_packages/google_ads_source/macros/get_ad_group_history_columns.sql b/dbt_packages/google_ads_source/macros/get_ad_group_history_columns.sql new file mode 100644 index 0000000..80d078a --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_ad_group_history_columns.sql @@ -0,0 +1,23 @@ +{% macro get_ad_group_history_columns() %} + +{% set columns = [ + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "ad_rotation_mode", "datatype": dbt_utils.type_string()}, + {"name": "base_ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "campaign_name", "datatype": dbt_utils.type_string()}, + {"name": "display_custom_bid_dimension", "datatype": dbt_utils.type_string()}, + {"name": "explorer_auto_optimizer_setting_opt_in", "datatype": "boolean"}, + {"name": "final_url_suffix", "datatype": dbt_utils.type_string()}, + {"name": "id", "datatype": dbt_utils.type_int()}, + {"name": "name", "datatype": dbt_utils.type_string()}, + {"name": "status", "datatype": dbt_utils.type_string()}, + {"name": "target_restrictions", "datatype": dbt_utils.type_string()}, + {"name": "tracking_url_template", "datatype": dbt_utils.type_string()}, + {"name": "type", "datatype": dbt_utils.type_string()}, + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()} +] %} + +{{ return(columns) }} + +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/macros/get_ad_history_columns.sql b/dbt_packages/google_ads_source/macros/get_ad_history_columns.sql new file mode 100644 index 0000000..fe62f12 --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_ad_history_columns.sql @@ -0,0 +1,29 @@ +{% macro get_ad_history_columns() %} + +{% set columns = [ + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "action_items", "datatype": dbt_utils.type_string()}, + {"name": "ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_strength", "datatype": dbt_utils.type_string()}, + {"name": "added_by_google_ads", "datatype": "boolean"}, + {"name": "device_preference", "datatype": dbt_utils.type_string()}, + {"name": "display_url", "datatype": dbt_utils.type_string()}, + {"name": "final_app_urls", "datatype": dbt_utils.type_string()}, + {"name": "final_mobile_urls", "datatype": dbt_utils.type_string()}, + {"name": "final_url_suffix", "datatype": dbt_utils.type_string()}, + {"name": "final_urls", "datatype": dbt_utils.type_string()}, + {"name": "id", "datatype": dbt_utils.type_int()}, + {"name": "name", "datatype": dbt_utils.type_string()}, + {"name": "policy_summary_approval_status", "datatype": dbt_utils.type_string()}, + {"name": "policy_summary_review_status", "datatype": dbt_utils.type_string()}, + {"name": "status", "datatype": dbt_utils.type_string()}, + {"name": "system_managed_resource_source", "datatype": dbt_utils.type_string()}, + {"name": "tracking_url_template", "datatype": dbt_utils.type_string()}, + {"name": "type", "datatype": dbt_utils.type_string()}, + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, + {"name": "url_collections", "datatype": dbt_utils.type_string()} +] %} + +{{ return(columns) }} + +{% endmacro %} diff --git a/dbt_packages/google_ads_source/macros/get_ad_stats_columns.sql b/dbt_packages/google_ads_source/macros/get_ad_stats_columns.sql new file mode 100644 index 0000000..66be845 --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_ad_stats_columns.sql @@ -0,0 +1,33 @@ +{% macro get_ad_stats_columns() %} + +{% set columns = [ + {"name": "_fivetran_id", "datatype": dbt_utils.type_string()}, + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "active_view_impressions", "datatype": dbt_utils.type_int()}, + {"name": "active_view_measurability", "datatype": dbt_utils.type_float()}, + {"name": "active_view_measurable_cost_micros", "datatype": dbt_utils.type_int()}, + {"name": "active_view_measurable_impressions", "datatype": dbt_utils.type_int()}, + {"name": "active_view_viewability", "datatype": dbt_utils.type_float()}, + {"name": "ad_group", "datatype": dbt_utils.type_string()}, + {"name": "ad_group_base_ad_group", "datatype": dbt_utils.type_string()}, + {"name": "ad_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_network_type", "datatype": dbt_utils.type_string()}, + {"name": "campaign_base_campaign", "datatype": dbt_utils.type_string()}, + {"name": "campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "clicks", "datatype": dbt_utils.type_int()}, + {"name": "conversions", "datatype": dbt_utils.type_float()}, + {"name": "conversions_value", "datatype": dbt_utils.type_float()}, + {"name": "cost_micros", "datatype": dbt_utils.type_int()}, + {"name": "customer_id", "datatype": dbt_utils.type_int()}, + {"name": "date", "datatype": "date"}, + {"name": "device", "datatype": dbt_utils.type_string()}, + {"name": "impressions", "datatype": dbt_utils.type_int()}, + {"name": "interaction_event_types", "datatype": dbt_utils.type_string()}, + {"name": "interactions", "datatype": dbt_utils.type_int()}, + {"name": "keyword_ad_group_criterion", "datatype": dbt_utils.type_string()}, + {"name": "view_through_conversions", "datatype": dbt_utils.type_int()} +] %} + +{{ return(columns) }} + +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/macros/get_campaign_history_columns.sql b/dbt_packages/google_ads_source/macros/get_campaign_history_columns.sql new file mode 100644 index 0000000..a70182b --- /dev/null +++ b/dbt_packages/google_ads_source/macros/get_campaign_history_columns.sql @@ -0,0 +1,30 @@ +{% macro get_campaign_history_columns() %} + +{% set columns = [ + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "ad_serving_optimization_status", "datatype": dbt_utils.type_string()}, + {"name": "advertising_channel_subtype", "datatype": dbt_utils.type_string()}, + {"name": "advertising_channel_type", "datatype": dbt_utils.type_string()}, + {"name": "base_campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "customer_id", "datatype": dbt_utils.type_int()}, + {"name": "end_date", "datatype": dbt_utils.type_string()}, + {"name": "experiment_type", "datatype": dbt_utils.type_string()}, + {"name": "final_url_suffix", "datatype": dbt_utils.type_string()}, + {"name": "frequency_caps", "datatype": dbt_utils.type_string()}, + {"name": "id", "datatype": dbt_utils.type_int()}, + {"name": "name", "datatype": dbt_utils.type_string()}, + {"name": "optimization_score", "datatype": dbt_utils.type_float()}, + {"name": "payment_mode", "datatype": dbt_utils.type_string()}, + {"name": "serving_status", "datatype": dbt_utils.type_string()}, + {"name": "start_date", "datatype": dbt_utils.type_string()}, + {"name": "status", "datatype": dbt_utils.type_string()}, + {"name": "tracking_url_template", "datatype": dbt_utils.type_string()}, + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, + {"name": "vanity_pharma_display_url_mode", "datatype": dbt_utils.type_string()}, + {"name": "vanity_pharma_text", "datatype": dbt_utils.type_string()}, + {"name": "video_brand_safety_suitability", "datatype": dbt_utils.type_string()} +] %} + +{{ return(columns) }} + +{% endmacro %} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/macros/staging_columns.sql b/dbt_packages/google_ads_source/macros/staging_columns.sql new file mode 100644 index 0000000..0a2f01e --- /dev/null +++ b/dbt_packages/google_ads_source/macros/staging_columns.sql @@ -0,0 +1,73 @@ +{% macro get_final_url_performance_columns() %} + +{% set columns = [ + {"name": "_fivetran_id", "datatype": dbt_utils.type_string()}, + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "account_descriptive_name", "datatype": dbt_utils.type_string(), "alias": "account_name"}, + {"name": "ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_group_name", "datatype": dbt_utils.type_string()}, + {"name": "ad_group_status", "datatype": dbt_utils.type_string()}, + {"name": "campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "campaign_name", "datatype": dbt_utils.type_string()}, + {"name": "campaign_status", "datatype": dbt_utils.type_string()}, + {"name": "clicks", "datatype": dbt_utils.type_int()}, + {"name": "cost", "datatype": dbt_utils.type_float(), "alias": "spend"}, + {"name": "date", "datatype": "date", "alias": "date_day"}, + {"name": "effective_final_url", "datatype": dbt_utils.type_string(), "alias": "final_url"}, + {"name": "external_customer_id", "datatype": dbt_utils.type_int()}, + {"name": "impressions", "datatype": dbt_utils.type_int()} +] %} + +{{ return(columns) }} + +{% endmacro %} + +{% macro get_click_performance_columns() %} + +{% set columns = [ + {"name": "_fivetran_id", "datatype": dbt_utils.type_string()}, + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "account_descriptive_name", "datatype": dbt_utils.type_string(), "alias": "account_name"}, + {"name": "ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_group_name", "datatype": dbt_utils.type_string()}, + {"name": "ad_group_status", "datatype": dbt_utils.type_string()}, + {"name": "campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "campaign_name", "datatype": dbt_utils.type_string()}, + {"name": "campaign_status", "datatype": dbt_utils.type_string()}, + {"name": "clicks", "datatype": dbt_utils.type_int()}, + {"name": "criteria_id", "datatype": dbt_utils.type_int()}, + {"name": "date", "datatype": "date", "alias": "date_day"}, + {"name": "external_customer_id", "datatype": dbt_utils.type_int()}, + {"name": "gcl_id", "datatype": dbt_utils.type_string(), "alias": "gclid"} +] %} + +{{ return(columns) }} + +{% endmacro %} + +{% macro get_criteria_performance_columns() %} + +{% set columns = [ + {"name": "_fivetran_id", "datatype": dbt_utils.type_string()}, + {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "account_descriptive_name", "datatype": dbt_utils.type_string(), "alias": "account_name"}, + {"name": "ad_group_id", "datatype": dbt_utils.type_int()}, + {"name": "ad_group_name", "datatype": dbt_utils.type_string()}, + {"name": "ad_group_status", "datatype": dbt_utils.type_string()}, + {"name": "campaign_id", "datatype": dbt_utils.type_int()}, + {"name": "campaign_name", "datatype": dbt_utils.type_string()}, + {"name": "campaign_status", "datatype": dbt_utils.type_string()}, + {"name": "clicks", "datatype": dbt_utils.type_int()}, + {"name": "cost", "datatype": dbt_utils.type_float(), "alias": "spend"}, + {"name": "criteria", "datatype": dbt_utils.type_string()}, + {"name": "criteria_destination_url", "datatype": dbt_utils.type_string()}, + {"name": "criteria_type", "datatype": dbt_utils.type_string()}, + {"name": "date", "datatype": "date", "alias": "date_day"}, + {"name": "external_customer_id", "datatype": dbt_utils.type_int()}, + {"name": "id", "datatype": dbt_utils.type_int()}, + {"name": "impressions", "datatype": dbt_utils.type_int()} +] %} + +{{ return(columns) }} + +{% endmacro %} diff --git a/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads.yml b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads.yml new file mode 100644 index 0000000..765105d --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads.yml @@ -0,0 +1,130 @@ +version: 2 + +models: + - name: stg_google_ads__click_performance + description: The Click Performance report includes stats aggregated at each click level. + columns: + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: criteria_id + description: "{{ doc('criteria_id') }}" + - name: date_day + description: "{{ doc('date') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: gclid + tests: + - not_null + description: "{{ doc('gcl_id') }}" + + - name: stg_google_ads__criteria_performance + description: The Criteria Performance report includes statistics aggregated at the ad group criteria level, one row per ad group and criteria combination. + columns: + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: spend + description: "{{ doc('cost') }}" + - name: criteria + description: "{{ doc('criteria') }}" + - name: criteria_destination_url + description: "{{ doc('criteria_destination_url') }}" + - name: criteria_type + description: "{{ doc('criteria_type') }}" + - name: date_day + description: "{{ doc('date') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: id + description: ID of the main object of this row. + - name: impressions + description: "{{ doc('impressions') }}" + + - name: stg_google_ads__final_url_performance + description: Each record represents the performance of a final url at the ad group level. + columns: + - name: final_url_performance_id + tests: + - unique + - not_null + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: spend + description: "{{ doc('cost') }}" + - name: date_day + description: "{{ doc('date') }}" + - name: final_url + description: "{{ doc('effective_final_url') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: impressions + description: "{{ doc('impressions') }}" + - name: base_url + description: "{{ doc('base_url') }}" + - name: url_host + description: "{{ doc('url_host') }}" + - name: url_path + description: "{{ doc('url_path') }}" + - name: utm_source + description: "{{ doc('utm_source') }}" + - name: utm_medium + description: "{{ doc('utm_medium') }}" + - name: utm_campaign + description: "{{ doc('utm_campaign') }}" + - name: utm_content + description: "{{ doc('utm_content') }}" + - name: utm_term + description: "{{ doc('utm_term') }}" diff --git a/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__click_performance.sql b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__click_performance.sql new file mode 100644 index 0000000..7041603 --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__click_performance.sql @@ -0,0 +1,25 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with source as ( + + select * + from {{ ref('stg_google_ads__click_performance_tmp') }} + +), + +renamed as ( + + select + + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__click_performance_tmp')), + staging_columns=get_click_performance_columns() + ) + }} + + from source + +) + +select * from renamed \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__criteria_performance.sql b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__criteria_performance.sql new file mode 100644 index 0000000..cb5f9e5 --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__criteria_performance.sql @@ -0,0 +1,29 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with source as ( + + select * + from {{ ref('stg_google_ads__criteria_performance_tmp') }} + +), + +renamed as ( + + select + + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__criteria_performance_tmp')), + staging_columns=get_criteria_performance_columns() + ) + }} + + {% for metric in var('google_ads__criteria_passthrough_metrics') %} + , {{ metric }} + {% endfor %} + + from source + +) + +select * from renamed \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__final_url_performance.sql b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__final_url_performance.sql new file mode 100644 index 0000000..8be97c9 --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/stg_google_ads__final_url_performance.sql @@ -0,0 +1,66 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +with source as ( + + select * + from {{ ref('stg_google_ads__final_url_performance_tmp') }} + +), + +renamed as ( + + select + + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__final_url_performance_tmp')), + staging_columns=get_final_url_performance_columns() + ) + }} + + {% for metric in var('google_ads__url_passthrough_metrics') %} + , {{ metric }} + {% endfor %} + + from source + +), + +url_fields as ( + + select + *, + {{ dbt_utils.split_part('final_url', "'?'", 1) }} as base_url, + {{ dbt_utils.get_url_host('final_url') }} as url_host, + '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path, + + {% if var('google_auto_tagging_enabled', false) %} + + coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} , 'google') as utm_source, + coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} , 'cpc') as utm_medium, + coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} , campaign_name) as utm_campaign, + coalesce( {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} , ad_group_name) as utm_content, + + {% else %} + + {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source, + {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium, + {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign, + {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content, + + {% endif %} + + {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term + + from renamed + +), surrogate_key as ( + + select + *, + {{ dbt_utils.surrogate_key(['date_day','campaign_id','ad_group_id','final_url']) }} as final_url_performance_id + from url_fields + +) + +select * from surrogate_key \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql new file mode 100644 index 0000000..50cda5d --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__click_performance_tmp.sql @@ -0,0 +1,4 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +select * +from {{ var('google_ads__click_performance') }} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql new file mode 100644 index 0000000..436dd6b --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__criteria_performance_tmp.sql @@ -0,0 +1,4 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +select * +from {{ var('google_ads__criteria_performance') }} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql new file mode 100644 index 0000000..e443020 --- /dev/null +++ b/dbt_packages/google_ads_source/models/adwords_connector/tmp/stg_google_ads__final_url_performance_tmp.sql @@ -0,0 +1,4 @@ +{{ config(enabled=var('api_source') == 'adwords') }} + +select * +from {{ var('google_ads__final_url_performance') }} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/docs.md b/dbt_packages/google_ads_source/models/docs.md new file mode 100644 index 0000000..67e8cf7 --- /dev/null +++ b/dbt_packages/google_ads_source/models/docs.md @@ -0,0 +1,140 @@ +{% docs _fivetran_id %} +Unique ID used by Fivetran to sync and dedupe data. +{% enddocs %} + +{% docs _fivetran_synced %} +Timestamp of when a record was last synced. +{% enddocs %} + +{% docs account_descriptive_name %} +The descriptive name of the Customer account. +{% enddocs %} + +{% docs ad_group_id %} +The ID of the AdGroup. +{% enddocs %} + +{% docs ad_group_name %} +The name of the AdGroup. +{% enddocs %} + +{% docs ad_group_status %} +Status of the ad group. +{% enddocs %} + +{% docs campaign_id %} +The ID of the Campaign. +{% enddocs %} + +{% docs ad_id %} +The ID of the Ad. +{% enddocs %} + +{% docs account_id %} +The ID of the Account. +{% enddocs %} + + +{% docs ad_status %} +Status of the Ad. +{% enddocs %} + +{% docs campaign_name %} +The name of the Campaign. +{% enddocs %} + +{% docs campaign_status %} +Status of the Campaign. +{% enddocs %} + +{% docs clicks %} +The number of clicks. +{% enddocs %} + +{% docs cost %} +The sum of your cost-per-click (CPC) and cost-per-thousand impressions (CPM) costs during this period. +{% enddocs %} + +{% docs date %} +The date being reported on. +{% enddocs %} + +{% docs effective_final_url %} +Effective final URL of the impressions. +{% enddocs %} + +{% docs external_customer_id %} +The Customer ID. +{% enddocs %} + +{% docs impressions %} +Count of how often your ad has appeared on a search results page or website on the Google Network. +{% enddocs %} + +{% docs criteria_id %} +The Criterion ID. +{% enddocs %} + +{% docs gcl_id %} +The Google Click ID. +{% enddocs %} + +{% docs criteria %} +Descriptive string for the Criterion. +{% enddocs %} + +{% docs criteria_destination_url %} +Destination URL of the criterion that triggered ads. +{% enddocs %} + +{% docs criteria_type %} +The type of the Criterion. +{% enddocs %} + +{% docs base_url %} +The base URL of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs url_host %} +The URL host of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs url_path %} +The URL path of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs utm_source %} +The utm_source parameter of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs utm_medium %} +The utm_medium parameter of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs utm_campaign %} +The utm_campaign parameter of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs utm_content %} +The utm_content parameter of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs utm_term %} +The utm_term parameter of the ad, extracted from the `effective_final_url`. +{% enddocs %} + +{% docs updated_at %} +Timestamp of when the record was last updated in Google Ads. +{% enddocs %} + +{% docs ad_type %} +The type of the ad in Google Ads. +{% enddocs %} + +{% docs ad_group_type %} +The type of the ad group in Google Ads. +{% enddocs %} + +{% docs is_most_recent_record %} +Boolean representing whether the record is the most recent version of the object. +{% enddocs %} \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads.yml b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads.yml new file mode 100644 index 0000000..ce4a9fa --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads.yml @@ -0,0 +1,119 @@ +version: 2 + +models: + - name: stg_google_ads__account_history + description: Each record represents a version of an account in Google Ads. + columns: + - name: account_id + description: "{{ doc('account_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: currency_code + description: The currency of the spend reported. + - name: account_name + description: "{{ doc('account_descriptive_name') }}" + - name: updated_at + description: "{{ doc('_fivetran_synced') }}" + - name: is_most_recent_record + description: "{{ doc('is_most_recent_record') }}" + + - name: stg_google_ads__ad_group_history + description: Each record represents a version of an ad group in Google Ads. + columns: + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: updated_timestamp + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: ad_group_type + description: "{{ doc('ad_group_type') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: is_most_recent_record + description: "{{ doc('is_most_recent_record') }}" + + - name: stg_google_ads__ad_history + description: Each record represents a version of an ad in Google Ads. + columns: + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_id + description: "{{ doc('ad_id') }}" + - name: updated_timestamp + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: ad_type + description: "{{ doc('ad_type') }}" + - name: ad_status + description: "{{ doc('ad_status') }}" + - name: is_most_recent_record + description: "{{ doc('is_most_recent_record') }}" + - name: source_final_urls + description: The original list of final urls expressed as an array. Please be aware the test used on this field is intended to warn you if you have fields with multiple urls. If you do, the `final_url` field will filter down the urls within the array to just the first. Therefore, this package will only leverage one of possibly many urls within this field array. + tests: + - dbt_expectations.expect_column_values_to_not_match_regex_list: + regex_list: "," + match_on: any + severity: warn + - name: final_url + description: The first url in the list of the urls within the `final_urls` source field. + - name: base_url + description: "{{ doc('base_url') }}" + - name: url_host + description: "{{ doc('url_host') }}" + - name: url_path + description: "{{ doc('url_path') }}" + - name: utm_source + description: "{{ doc('utm_source') }}" + - name: utm_medium + description: "{{ doc('utm_medium') }}" + - name: utm_campaign + description: "{{ doc('utm_campaign') }}" + - name: utm_content + description: "{{ doc('utm_content') }}" + - name: utm_term + description: "{{ doc('utm_term') }}" + + - name: stg_google_ads__ad_stats + description: Each record represents the daily performance of an ad in Google Ads. + columns: + - name: account_id + description: "{{ doc('external_customer_id') }}" + - name: date_day + description: "{{ doc('date') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_id + description: "{{ doc('ad_id') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: spend + description: "{{ doc('cost') }}" + - name: impressions + description: "{{ doc('impressions') }}" + + - name: stg_google_ads__campaign_history + description: Each record represents a version of a campaign in Google Ads. + columns: + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: updated_timestamp + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: account_id + description: "{{ doc('external_customer_id') }}" + - name: is_most_recent_record + description: "{{ doc('is_most_recent_record') }}" diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__account_history.sql b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__account_history.sql new file mode 100644 index 0000000..649cdd4 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__account_history.sql @@ -0,0 +1,43 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with base as ( + + select * + from {{ ref('stg_google_ads__account_history_tmp') }} + +), + +fields as ( + + select + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__account_history_tmp')), + staging_columns=get_account_history_columns() + ) + }} + + from base +), + +final as ( + + select + id as account_id, + updated_at, + _fivetran_synced, + currency_code, + descriptive_name as account_name + from fields +), + +most_recent as ( + + select + *, + row_number() over (partition by account_id order by updated_at desc) = 1 as is_most_recent_record + from final + +) + +select * from most_recent diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_group_history.sql b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_group_history.sql new file mode 100644 index 0000000..771fb17 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_group_history.sql @@ -0,0 +1,46 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with base as ( + + select * + from {{ ref('stg_google_ads__ad_group_history_tmp') }} + +), + +fields as ( + + select + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_group_history_tmp')), + staging_columns=get_ad_group_history_columns() + ) + }} + + from base +), + +final as ( + + select + id as ad_group_id, + updated_at as updated_timestamp, + _fivetran_synced, + type as ad_group_type, + campaign_id, + campaign_name, + name as ad_group_name, + status as ad_group_status + from fields +), + +most_recent as ( + + select + *, + row_number() over (partition by ad_group_id order by updated_timestamp desc) = 1 as is_most_recent_record + from final + +) + +select * from most_recent \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_history.sql b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_history.sql new file mode 100644 index 0000000..c974e58 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_history.sql @@ -0,0 +1,71 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with base as ( + + select * + from {{ ref('stg_google_ads__ad_history_tmp') }} + +), + +fields as ( + + select + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_history_tmp')), + staging_columns=get_ad_history_columns() + ) + }} + + from base +), + +final as ( + + select + ad_group_id, + id as ad_id, + updated_at as updated_timestamp, + _fivetran_synced, + type as ad_type, + status as ad_status, + final_urls as source_final_urls, + replace(replace(final_urls, '[', ''),']','') as final_urls + from fields +), + +most_recent as ( + + select + ad_group_id, + ad_id, + updated_timestamp, + _fivetran_synced, + ad_type, + ad_status, + source_final_urls, + + --Extract the first url within the list of urls provided within the final_urls field + {{ dbt_utils.split_part(string_text='final_urls', delimiter_text="','", part_number=1) }} as final_url, + + row_number() over (partition by ad_id order by updated_timestamp desc) = 1 as is_most_recent_record + from final + +), + +url_fields as ( + select + *, + {{ dbt_utils.split_part('final_url', "'?'", 1) }} as base_url, + {{ dbt_utils.get_url_host('final_url') }} as url_host, + '/' || {{ dbt_utils.get_url_path('final_url') }} as url_path, + {{ dbt_utils.get_url_parameter('final_url', 'utm_source') }} as utm_source, + {{ dbt_utils.get_url_parameter('final_url', 'utm_medium') }} as utm_medium, + {{ dbt_utils.get_url_parameter('final_url', 'utm_campaign') }} as utm_campaign, + {{ dbt_utils.get_url_parameter('final_url', 'utm_content') }} as utm_content, + {{ dbt_utils.get_url_parameter('final_url', 'utm_term') }} as utm_term + from most_recent +) + +select * +from url_fields diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_stats.sql b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_stats.sql new file mode 100644 index 0000000..c8e66d7 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__ad_stats.sql @@ -0,0 +1,41 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with base as ( + + select * + from {{ ref('stg_google_ads__ad_stats_tmp') }} + +), + +fields as ( + + select + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__ad_stats_tmp')), + staging_columns=get_ad_stats_columns() + ) + }} + + from base +), + +final as ( + + select + customer_id as account_id, + date as date_day, + ad_group as ad_group_id, + ad_id, + campaign_id, + clicks, + cost_micros / 1000000.0 as spend, + impressions + + {% for metric in var('google_ads__ad_stats_passthrough_metrics') %} + , {{ metric }} + {% endfor %} + from fields +) + +select * from final diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__campaign_history.sql b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__campaign_history.sql new file mode 100644 index 0000000..6d31426 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/stg_google_ads__campaign_history.sql @@ -0,0 +1,43 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +with base as ( + + select * + from {{ ref('stg_google_ads__campaign_history_tmp') }} + +), + +fields as ( + + select + {{ + fivetran_utils.fill_staging_columns( + source_columns=adapter.get_columns_in_relation(ref('stg_google_ads__campaign_history_tmp')), + staging_columns=get_campaign_history_columns() + ) + }} + + from base +), + +final as ( + + select + id as campaign_id, + updated_at as updated_timestamp, + _fivetran_synced, + name as campaign_name, + customer_id as account_id + from fields +), + +most_recent as ( + + select + *, + row_number() over (partition by campaign_id order by updated_timestamp desc) = 1 as is_most_recent_record + from final + +) + +select * from most_recent \ No newline at end of file diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql new file mode 100644 index 0000000..6b30b79 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__account_history_tmp.sql @@ -0,0 +1,3 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +select * from {{ var('google_ads__account_history') }} diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql new file mode 100644 index 0000000..b2c93c7 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_group_history_tmp.sql @@ -0,0 +1,3 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +select * from {{ var('google_ads__ad_group_history') }} diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql new file mode 100644 index 0000000..e62118e --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_history_tmp.sql @@ -0,0 +1,3 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +select * from {{ var('google_ads__ad_history') }} diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql new file mode 100644 index 0000000..402b3c2 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__ad_stats_tmp.sql @@ -0,0 +1,3 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +select * from {{ var('google_ads__ad_stats') }} diff --git a/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql new file mode 100644 index 0000000..4cecc13 --- /dev/null +++ b/dbt_packages/google_ads_source/models/google_ads_connector/tmp/stg_google_ads__campaign_history_tmp.sql @@ -0,0 +1,3 @@ +{{ config(enabled=var('api_source') == 'google_ads') }} + +select * from {{ var('google_ads__campaign_history') }} diff --git a/dbt_packages/google_ads_source/models/src_google_ads.yml b/dbt_packages/google_ads_source/models/src_google_ads.yml new file mode 100644 index 0000000..432313e --- /dev/null +++ b/dbt_packages/google_ads_source/models/src_google_ads.yml @@ -0,0 +1,200 @@ +version: 2 + +sources: + - name: adwords + schema: "{{ var('google_ads_schema', var('api_source')) }}" + database: "{% if target.type != 'spark'%}{{ var('google_ads_database', target.database) }}{% endif %}" + + loader: Fivetran + loaded_at_field: _fivetran_synced + + tables: + - name: ad_stats + description: Each record represents the daily performance of an ad in Google Ads. + columns: + - name: customer_id + description: "{{ doc('external_customer_id') }}" + - name: date + description: "{{ doc('date') }}" + - name: ad_group + description: "{{ doc('ad_group_id') }}" + - name: ad_id + description: "{{ doc('ad_id') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: cost_micros + description: "{{ doc('cost') }}" + - name: impressions + description: "{{ doc('impressions') }}" + + - name: ad_history + description: Each record represents a version of an ad in Google Ads. + columns: + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: id + description: "{{ doc('ad_id') }}" + - name: updated_at + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: type + description: "{{ doc('ad_type') }}" + - name: status + description: "{{ doc('ad_status') }}" + - name: final_urls + description: A list of urls that are used for the ad. + + - name: ad_group_history + description: Each record represents a version of an ad group in Google Ads. + columns: + - name: id + description: "{{ doc('ad_group_id') }}" + - name: updated_at + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: type + description: "{{ doc('ad_group_type') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: name + description: "{{ doc('ad_group_name') }}" + - name: status + description: "{{ doc('ad_group_status') }}" + + - name: campaign_history + description: Each record represents a version of a campaign in Google Ads. + columns: + - name: id + description: "{{ doc('campaign_id') }}" + - name: updated_at + description: "{{ doc('updated_at') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: name + description: "{{ doc('campaign_name') }}" + - name: customer_id + description: "{{ doc('external_customer_id') }}" + + - name: account_history + description: Each record represents a historical version of an account in Google Ads. + columns: + - name: id + description: "{{ doc('account_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: currency_code + description: The currency of the spend reported. + - name: descriptive_name + description: "{{ doc('account_descriptive_name') }}" + - name: updated_at + description: "{{ doc('updated_at') }}" + + - name: final_url_performance + description: Each record represents the performance of a final url at the ad group level. + columns: + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_descriptive_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: cost + description: "{{ doc('cost') }}" + - name: date + description: "{{ doc('date') }}" + - name: effective_final_url + description: "{{ doc('effective_final_url') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: impressions + description: "{{ doc('impressions') }}" + - name: click_performance + description: The Click Performance report includes stats aggregated at each click level. + columns: + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_descriptive_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: criteria_id + description: "{{ doc('criteria_id') }}" + - name: date + description: "{{ doc('date') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: gcl_id + description: "{{ doc('gcl_id') }}" + - name: criteria_performance + description: The Criteria Performance report includes statistics aggregated at the ad group criteria level, one row per ad group and criteria combination. + columns: + - name: _fivetran_id + description: "{{ doc('_fivetran_id') }}" + - name: _fivetran_synced + description: "{{ doc('_fivetran_synced') }}" + - name: account_descriptive_name + description: "{{ doc('account_descriptive_name') }}" + - name: ad_group_id + description: "{{ doc('ad_group_id') }}" + - name: ad_group_name + description: "{{ doc('ad_group_name') }}" + - name: ad_group_status + description: "{{ doc('ad_group_status') }}" + - name: campaign_id + description: "{{ doc('campaign_id') }}" + - name: campaign_name + description: "{{ doc('campaign_name') }}" + - name: campaign_status + description: "{{ doc('campaign_status') }}" + - name: clicks + description: "{{ doc('clicks') }}" + - name: cost + description: "{{ doc('cost') }}" + - name: criteria + description: "{{ doc('criteria') }}" + - name: criteria_destination_url + description: "{{ doc('criteria_destination_url') }}" + - name: criteria_type + description: "{{ doc('criteria_type') }}" + - name: date + description: "{{ doc('date') }}" + - name: external_customer_id + description: "{{ doc('external_customer_id') }}" + - name: id + description: ID of the main object of this row. + - name: impressions + description: "{{ doc('impressions') }}" \ No newline at end of file diff --git a/dbt_packages/google_ads_source/packages.yml b/dbt_packages/google_ads_source/packages.yml new file mode 100644 index 0000000..7cd7d05 --- /dev/null +++ b/dbt_packages/google_ads_source/packages.yml @@ -0,0 +1,9 @@ +packages: +- package: calogica/dbt_expectations + version: [">=0.5.0", "<0.6.0"] + +- package: fivetran/fivetran_utils + version: [">=0.3.0", "<0.4.0"] + +- package: dbt-labs/spark_utils + version: [">=0.3.0", "<0.4.0"] diff --git a/dbt_packages/spark_utils/.circleci/config.yml b/dbt_packages/spark_utils/.circleci/config.yml new file mode 100644 index 0000000..7f31af4 --- /dev/null +++ b/dbt_packages/spark_utils/.circleci/config.yml @@ -0,0 +1,77 @@ +version: 2.1 + +jobs: + + integration-dbt-utils-databricks: &databricks-odbc + environment: + DBT_INVOCATION_ENV: circle + ODBC_DRIVER: Simba # TODO: move env var to Docker image + docker: + # image based on `fishtownanalytics/test-container` w/ Simba ODBC Spark driver installed + - image: 828731156495.dkr.ecr.us-east-1.amazonaws.com/dbt-spark-odbc-test-container:latest + aws_auth: + aws_access_key_id: $AWS_ACCESS_KEY_ID_STAGING + aws_secret_access_key: $AWS_SECRET_ACCESS_KEY_STAGING + + steps: + - checkout + + - run: &pull-submodules + name: "Pull Submodules" + command: | + git submodule init + git submodule sync --recursive + git submodule foreach --recursive git fetch + git submodule update --init --recursive + + - run: &setup-dbt + name: "Setup dbt" + command: | + python3.8 -m venv venv + . venv/bin/activate + pip install --upgrade pip setuptools + pip install --pre --upgrade dbt-spark[ODBC] + mkdir -p ~/.dbt + cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml + + - run: + name: "Run Tests - dbt-utils" + + command: | + . venv/bin/activate + cd integration_tests/dbt_utils + dbt deps --target databricks-utils + dbt seed --target databricks-utils --full-refresh + dbt run --target databricks-utils --full-refresh + dbt test --target databricks-utils + + - store_artifacts: + path: ./logs + + integration-snowplow-databricks: + <<: *databricks-odbc + steps: + - checkout + - run: *pull-submodules + - run: *setup-dbt + + - run: + name: "Run Tests - Snowplow" + command: | + . venv/bin/activate + cd integration_tests/snowplow + dbt deps --target databricks-snowplow + dbt seed --target databricks-snowplow --full-refresh + dbt run --target databricks-snowplow --full-refresh --vars 'update: false' + dbt run --target databricks-snowplow --vars 'update: true' + dbt test --target databricks-snowplow + + - store_artifacts: + path: ./logs + +workflows: + version: 2 + test-shims: + jobs: + - integration-dbt-utils-databricks + - integration-snowplow-databricks diff --git a/dbt_packages/spark_utils/.gitignore b/dbt_packages/spark_utils/.gitignore new file mode 100644 index 0000000..a0e4833 --- /dev/null +++ b/dbt_packages/spark_utils/.gitignore @@ -0,0 +1,6 @@ + +/**/target/ +/**/dbt_modules/ +/**/dbt_packages/ +/**/logs/ +/**/env/ diff --git a/dbt_packages/spark_utils/.gitmodules b/dbt_packages/spark_utils/.gitmodules new file mode 100644 index 0000000..9ef384c --- /dev/null +++ b/dbt_packages/spark_utils/.gitmodules @@ -0,0 +1,6 @@ +[submodule "dbt-utils"] + path = dbt-utils + url = https://github.com/dbt-labs/dbt-utils +[submodule "snowplow"] + path = snowplow + url = https://github.com/dbt-labs/snowplow diff --git a/dbt_packages/spark_utils/CHANGELOG.md b/dbt_packages/spark_utils/CHANGELOG.md new file mode 100644 index 0000000..de458dd --- /dev/null +++ b/dbt_packages/spark_utils/CHANGELOG.md @@ -0,0 +1,12 @@ +# spark-utils v0.3.0 +This release supports any version (minor and patch) of v1, which means far less need for compatibility releases in the future. + +### Features +- Add macros for common maintenance operations ([#18](https://github.com/dbt-labs/spark-utils/pull/18)) + +### Contributors +- [@JCZuurmond](https://github.com/JCZuurmond) ([#18](https://github.com/dbt-labs/dbt-external-tables/pull/18)) +- [@NielsZeilemaker](https://github.com/NielsZeilemaker) ([#18](https://github.com/dbt-labs/dbt-external-tables/pull/18)) + +# spark-utils v0.2.4 +🚨 This is a compatibility release in preparation for `dbt-core` v1.0.0 (🎉) diff --git a/dbt_packages/spark_utils/LICENSE b/dbt_packages/spark_utils/LICENSE new file mode 100644 index 0000000..cd482d8 --- /dev/null +++ b/dbt_packages/spark_utils/LICENSE @@ -0,0 +1,201 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/dbt_packages/spark_utils/README.md b/dbt_packages/spark_utils/README.md new file mode 100644 index 0000000..fa9cff5 --- /dev/null +++ b/dbt_packages/spark_utils/README.md @@ -0,0 +1,70 @@ +This [dbt](https://github.com/dbt-labs/dbt) package contains macros +that: +- can be (re)used across dbt projects running on Spark +- define Spark-specific implementations of [dispatched macros](https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch) from other packages + +## Installation Instructions + +Check [dbt Hub](https://hub.getdbt.com) for the latest installation +instructions, or [read the docs](https://docs.getdbt.com/docs/package-management) +for more information on installing packages. + +---- + +## Compatibility + +This package provides "shims" for: +- [dbt_utils](https://github.com/dbt-labs/dbt-utils), except for: + - `dbt_utils.get_relations_by_prefix_sql` + - `dbt_utils.get_tables_by_pattern_sql` + - `dbt_utils.get_tables_by_prefix` + - `dbt_utils.get_tables_by_pattern` +- [snowplow](https://github.com/dbt-labs/snowplow) (tested on Databricks only) + +In order to use these "shims," you should set a `dispatch` config in your root project (on dbt v0.20.0 and newer). For example, with this project setting, dbt will first search for macro implementations inside the `spark_utils` package when resolving macros from the `dbt_utils` namespace: +``` +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] +``` + +### Note to maintainers of other packages + +The spark-utils package may be able to provide compatibility for your package, especially if your package leverages dbt-utils macros for cross-database compatibility. This package _does not_ need to be specified as a depedency of your package in `packages.yml`. Instead, you should encourage anyone using your package on Apache Spark / Databricks to: +- Install `spark_utils` alongside your package +- Add a `dispatch` config in their root project, like the one above + +---- + +## Useful macros: maintenance + +_Caveat: These are not tested in CI, or guaranteed to work on all platforms._ + +Each of these macros accepts a regex pattern, finds tables with names matching the pattern, and will loop over those tables to perform a maintenance operation: + +- `spark_optimize_delta_tables`: Runs `optimize` for all matched Delta tables +- `spark_vacuum_delta_tables`: Runs `vacuum` for all matched Delta tables +- `spark_analyze_tables`: Compute statistics for all matched tables + +---- + +### Contributing + +We welcome contributions to this repo! To contribute a new feature or a fix, +please open a Pull Request with 1) your changes and 2) updated documentation for +the `README.md` file. + +---- + +### Getting started with dbt + Spark + +- [What is dbt](https://docs.getdbt.com/docs/introduction)? +- [Installation](https://github.com/dbt-labs/dbt-spark) +- Join the #spark channel in [dbt Slack](http://slack.getdbt.com/) + + +## Code of Conduct + +Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, +and mailing lists is expected to follow the +[PyPA Code of Conduct](https://www.pypa.io/en/latest/code-of-conduct/). diff --git a/dbt_packages/spark_utils/dbt_project.yml b/dbt_packages/spark_utils/dbt_project.yml new file mode 100644 index 0000000..14f6bec --- /dev/null +++ b/dbt_packages/spark_utils/dbt_project.yml @@ -0,0 +1,5 @@ +name: 'spark_utils' +version: '0.3.0' +config-version: 2 +require-dbt-version: [">=1.0.0", "<2.0.0"] +macro-paths: ["macros"] \ No newline at end of file diff --git a/dbt_packages/spark_utils/integration_tests/ci/sample.profiles.yml b/dbt_packages/spark_utils/integration_tests/ci/sample.profiles.yml new file mode 100644 index 0000000..dcbe481 --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/ci/sample.profiles.yml @@ -0,0 +1,36 @@ + +# HEY! This file is used in the spark_utils integrations tests with CircleCI. +# You should __NEVER__ check credentials into version control. Thanks for reading :) + +config: + send_anonymous_usage_stats: False + use_colors: True + +integration_tests: + target: spark + outputs: + spark: + type: spark + method: thrift + schema: spark_utils_dbt_utils_integration_tests + host: "{{ env_var('SPARK_TEST_HOST') }}" + port: "{{ env_var('SPARK_TEST_PORT') | as_number }}" + user: "{{ env_var('SPARK_TEST_USER') }}" + connect_retries: 5 + connect_timeout: 60 + threads: 5 + + databricks-utils: &databricks-odbc + type: spark + host: "{{ env_var('DBT_DATABRICKS_HOST_NAME') }}" + endpoint: "{{ env_var('DBT_DATABRICKS_ENDPOINT') }}" + token: "{{ env_var('DBT_DATABRICKS_TOKEN') }}" + method: odbc + driver: "{{ env_var('ODBC_DRIVER') }}" + port: 443 + threads: 5 + schema: spark_utils_dbt_utils_integration_tests + + databricks-snowplow: + <<: *databricks-odbc + schema: spark_utils_snowplow_integration_tests diff --git a/dbt_packages/spark_utils/integration_tests/dbt_project.yml b/dbt_packages/spark_utils/integration_tests/dbt_project.yml new file mode 100644 index 0000000..398f72c --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/dbt_project.yml @@ -0,0 +1,3 @@ +name: 'spark_utils_integration_tests' +version: '0.1.0' +config-version: 2 diff --git a/dbt_packages/spark_utils/integration_tests/dbt_utils/Makefile b/dbt_packages/spark_utils/integration_tests/dbt_utils/Makefile new file mode 100644 index 0000000..dc3879e --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/dbt_utils/Makefile @@ -0,0 +1,12 @@ + +test-spark: + dbt deps + dbt seed --target spark --full-refresh --no-version-check + dbt run --target spark --full-refresh --no-version-check + dbt test --target spark --no-version-check + +test-databricks: + dbt deps + dbt seed --target databricks --full-refresh + dbt run --target databricks --full-refresh + dbt test --target databricks diff --git a/dbt_packages/spark_utils/integration_tests/dbt_utils/dbt_project.yml b/dbt_packages/spark_utils/integration_tests/dbt_utils/dbt_project.yml new file mode 100644 index 0000000..cb0f38b --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/dbt_utils/dbt_project.yml @@ -0,0 +1,43 @@ + +name: 'spark_utils_dbt_utils_integration_tests' +version: '1.0' +config-version: 2 + +profile: 'integration_tests' + +source-paths: ["models"] +analysis-paths: ["analysis"] +test-paths: ["tests"] +data-paths: ["data"] +macro-paths: ["macros"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_modules" + +dispatch: + - macro_namespace: dbt_utils + search_order: + - spark_utils + - dbt_utils_integration_tests + - dbt_utils + +seeds: + dbt_utils_integration_tests: + +file_format: delta + +models: + dbt_utils_integration_tests: + +file_format: delta + sql: + # macro doesn't work for this integration test (schema pattern) + test_get_relations_by_pattern: + +enabled: false + # integration test doesn't work + test_groupby: + +enabled: false + schema_tests: + # integration test doesn't work + test_recency: + +enabled: false diff --git a/dbt_packages/spark_utils/integration_tests/dbt_utils/packages.yml b/dbt_packages/spark_utils/integration_tests/dbt_utils/packages.yml new file mode 100644 index 0000000..cec9761 --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/dbt_utils/packages.yml @@ -0,0 +1,5 @@ + +packages: + - local: ../../ + - local: ../../dbt-utils + - local: ../../dbt-utils/integration_tests diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/Makefile b/dbt_packages/spark_utils/integration_tests/snowplow/Makefile new file mode 100644 index 0000000..312707b --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/Makefile @@ -0,0 +1,7 @@ + +test-databricks: + dbt deps + dbt seed --target databricks --full-refresh + dbt run --target databricks --full-refresh --vars 'update: false' + dbt run --target databricks --vars 'update: true' + dbt test --target databricks diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/dbt_project.yml b/dbt_packages/spark_utils/integration_tests/snowplow/dbt_project.yml new file mode 100644 index 0000000..b0dd700 --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/dbt_project.yml @@ -0,0 +1,79 @@ + +name: 'spark_utils_snowplow_integration_tests' +version: '1.0' +config-version: 2 + +profile: 'integration_tests' + +source-paths: ["models"] +analysis-paths: ["analysis"] +test-paths: ["tests"] +data-paths: ["data"] +macro-paths: ["macros"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_modules" + +dispatch: + - macro_namespace: dbt_utils + search_order: ['spark_utils', 'dbt_utils'] + - macro_namespace: snowplow + search_order: ['spark_utils', 'snowplow'] + +models: + incremental_strategy: merge + file_format: delta + + snowplow_integration_tests: + pre: + default: + base_event: + +enabled: false + post: + page_views: + default: + page_views_expected: + +enabled: false + sessions: + default: + sessions_expected: + +enabled: false + +vars: + 'snowplow:timezone': 'America/New_York' + 'snowplow:events': '{{ ref("base_event") }}' + 'snowplow:context:web_page': '{{ ref("base_web_page") }}' + 'snowplow:context:performance_timing': FALSE + 'snowplow:context:useragent': FALSE + 'snowplow:pass_through_columns': ['test_add_col'] + +seeds: + quote_columns: false + + snowplow_integration_tests: + event: + +column_types: + br_cookies: string + br_features_director: string + br_features_flash: string + br_features_gears: string + br_features_java: string + br_features_pdf: string + br_features_quicktime: string + br_features_realplayer: string + br_features_silverlight: string + br_features_windowsmedia: string + collector_tstamp: string + derived_tstamp: string + dvce_ismobile: string + expected: + snowplow_page_views_expected: + +column_types: + page_view_start: string + page_view_end: string + snowplow_sessions_expected: + +column_types: + session_start: string + session_end: string diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/models/base_event.sql b/dbt_packages/spark_utils/integration_tests/snowplow/models/base_event.sql new file mode 100644 index 0000000..347859d --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/models/base_event.sql @@ -0,0 +1,41 @@ +{%- set cols = adapter.get_columns_in_relation(ref('sp_event')) -%} +{%- set col_list = [] -%} + +{% set type_overrides = { + "br_cookies": "boolean", + "br_features_director": "boolean", + "br_features_flash": "boolean", + "br_features_gears": "boolean", + "br_features_java": "boolean", + "br_features_pdf": "boolean", + "br_features_quicktime": "boolean", + "br_features_realplayer": "boolean", + "br_features_silverlight": "boolean", + "br_features_windowsmedia": "boolean", + "collector_tstamp": "timestamp", + "derived_tstamp": "timestamp", + "dvce_ismobile": "boolean" +} %} + +{%- for col in cols -%} + {%- set col_statement -%} + {%- if col.column in type_overrides.keys() %} + cast({{col.column}} as {{type_overrides[col.column]}}) as {{col.column}} + {% else %} + {{col.column}} + {% endif -%} + {%- endset -%} + {%- do col_list.append(col_statement) -%} +{%- endfor -%} + +{%- set col_list_csv = col_list|join(',') -%} + +select {{col_list_csv}} from {{ ref('sp_event') }} + +{% if var('update', False) %} + + union all + + select {{col_list_csv}} from {{ ref('sp_event_update') }} + +{% endif %} diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/models/page_views_expected.sql b/dbt_packages/spark_utils/integration_tests/snowplow/models/page_views_expected.sql new file mode 100644 index 0000000..9a28bda --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/models/page_views_expected.sql @@ -0,0 +1,24 @@ +{{config(enabled=snowplow.is_adapter('default'))}} + +select + + user_custom_id, + user_snowplow_domain_id, + user_snowplow_crossdomain_id, + session_id, + session_index, + page_view_id, + to_timestamp(page_view_start) as page_view_start, + to_timestamp(page_view_end) as page_view_end, + time_engaged_in_s, + horizontal_percentage_scrolled, + vertical_percentage_scrolled, + page_url, + marketing_medium, + marketing_source, + marketing_term, + marketing_content, + marketing_campaign, + test_add_col + +from {{ ref('snowplow_page_views_expected') }} diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/models/sessions_expected.sql b/dbt_packages/spark_utils/integration_tests/snowplow/models/sessions_expected.sql new file mode 100644 index 0000000..329f865 --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/models/sessions_expected.sql @@ -0,0 +1,24 @@ +{{config(enabled=snowplow.is_adapter('default'))}} + +select + user_custom_id, + inferred_user_id, + user_snowplow_domain_id, + user_snowplow_crossdomain_id, + app_id, + first_page_url, + marketing_medium, + marketing_source, + marketing_term, + marketing_campaign, + marketing_content, + referer_url, + to_timestamp(session_start) as session_start, + to_timestamp(session_end) as session_end, + session_id, + time_engaged_in_s, + session_index, + first_test_add_col, + last_test_add_col + +from {{ ref('snowplow_sessions_expected') }} diff --git a/dbt_packages/spark_utils/integration_tests/snowplow/packages.yml b/dbt_packages/spark_utils/integration_tests/snowplow/packages.yml new file mode 100644 index 0000000..af11136 --- /dev/null +++ b/dbt_packages/spark_utils/integration_tests/snowplow/packages.yml @@ -0,0 +1,5 @@ + +packages: + - local: ../../ + - local: ../../snowplow + - local: ../../snowplow/integration_tests diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/concat.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/concat.sql new file mode 100644 index 0000000..30f1a42 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/concat.sql @@ -0,0 +1,3 @@ +{% macro spark__concat(fields) -%} + concat({{ fields|join(', ') }}) +{%- endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/current_timestamp.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/current_timestamp.sql new file mode 100644 index 0000000..2006bb2 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/current_timestamp.sql @@ -0,0 +1,8 @@ +{% macro spark__current_timestamp() %} + current_timestamp() +{% endmacro %} + + +{% macro spark__current_timestamp_in_utc() %} + unix_timestamp() +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datatypes.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datatypes.sql new file mode 100644 index 0000000..c935d02 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datatypes.sql @@ -0,0 +1,5 @@ +{# numeric ------------------------------------------------ #} + +{% macro spark__type_numeric() %} + decimal(28, 6) +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/dateadd.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/dateadd.sql new file mode 100644 index 0000000..e433bc7 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/dateadd.sql @@ -0,0 +1,62 @@ +{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %} + + {%- set clock_component -%} + {# make sure the dates + timestamps are real, otherwise raise an error asap #} + to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }}) + - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }}) + {%- endset -%} + + {%- if datepart in ['day', 'week'] -%} + + {%- set multiplier = 7 if datepart == 'week' else 1 -%} + + to_timestamp( + to_unix_timestamp( + date_add( + {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }}, + cast({{interval}} * {{multiplier}} as int) + ) + ) + {{clock_component}} + ) + + {%- elif datepart in ['month', 'quarter', 'year'] -%} + + {%- set multiplier -%} + {%- if datepart == 'month' -%} 1 + {%- elif datepart == 'quarter' -%} 3 + {%- elif datepart == 'year' -%} 12 + {%- endif -%} + {%- endset -%} + + to_timestamp( + to_unix_timestamp( + add_months( + {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }}, + cast({{interval}} * {{multiplier}} as int) + ) + ) + {{clock_component}} + ) + + {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%} + + {%- set multiplier -%} + {%- if datepart == 'hour' -%} 3600 + {%- elif datepart == 'minute' -%} 60 + {%- elif datepart == 'second' -%} 1 + {%- elif datepart == 'millisecond' -%} (1/1000000) + {%- elif datepart == 'microsecond' -%} (1/1000000) + {%- endif -%} + {%- endset -%} + + to_timestamp( + {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }} + + cast({{interval}} * {{multiplier}} as int) + ) + + {%- else -%} + + {{ exceptions.raise_compiler_error("macro dateadd not implemented for datepart ~ '" ~ datepart ~ "' ~ on Spark") }} + + {%- endif -%} + +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datediff.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datediff.sql new file mode 100644 index 0000000..0496cfa --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/datediff.sql @@ -0,0 +1,107 @@ +{% macro spark__datediff(first_date, second_date, datepart) %} + + {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%} + + {# make sure the dates are real, otherwise raise an error asap #} + {% set first_date = spark_utils.assert_not_null('date', first_date) %} + {% set second_date = spark_utils.assert_not_null('date', second_date) %} + + {%- endif -%} + + {%- if datepart == 'day' -%} + + datediff({{second_date}}, {{first_date}}) + + {%- elif datepart == 'week' -%} + + case when {{first_date}} < {{second_date}} + then floor(datediff({{second_date}}, {{first_date}})/7) + else ceil(datediff({{second_date}}, {{first_date}})/7) + end + + -- did we cross a week boundary (Sunday)? + + case + when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1 + when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1 + else 0 end + + {%- elif datepart == 'month' -%} + + case when {{first_date}} < {{second_date}} + then floor(months_between(date({{second_date}}), date({{first_date}}))) + else ceil(months_between(date({{second_date}}), date({{first_date}}))) + end + + -- did we cross a month boundary? + + case + when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1 + when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1 + else 0 end + + {%- elif datepart == 'quarter' -%} + + case when {{first_date}} < {{second_date}} + then floor(months_between(date({{second_date}}), date({{first_date}}))/3) + else ceil(months_between(date({{second_date}}), date({{first_date}}))/3) + end + + -- did we cross a quarter boundary? + + case + when {{first_date}} < {{second_date}} and ( + (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4)) + < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4)) + ) then 1 + when {{first_date}} > {{second_date}} and ( + (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4)) + > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4)) + ) then -1 + else 0 end + + {%- elif datepart == 'year' -%} + + year({{second_date}}) - year({{first_date}}) + + {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%} + + {%- set divisor -%} + {%- if datepart == 'hour' -%} 3600 + {%- elif datepart == 'minute' -%} 60 + {%- elif datepart == 'second' -%} 1 + {%- elif datepart == 'millisecond' -%} (1/1000) + {%- elif datepart == 'microsecond' -%} (1/1000000) + {%- endif -%} + {%- endset -%} + + case when {{first_date}} < {{second_date}} + then ceil(( + {# make sure the timestamps are real, otherwise raise an error asap #} + {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }} + - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }} + ) / {{divisor}}) + else floor(( + {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }} + - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }} + ) / {{divisor}}) + end + + {% if datepart == 'millisecond' %} + + cast(date_format({{second_date}}, 'SSS') as int) + - cast(date_format({{first_date}}, 'SSS') as int) + {% endif %} + + {% if datepart == 'microsecond' %} + {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %} + -- Spark doesn't really support microseconds, so this is a massive hack! + -- It will only work if the timestamp-string is of the format + -- 'yyyy-MM-dd-HH mm.ss.SSSSSS' + + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int) + - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) + {% endif %} + + {%- else -%} + + {{ exceptions.raise_compiler_error("macro datediff not implemented for datepart ~ '" ~ datepart ~ "' ~ on Spark") }} + + {%- endif -%} + +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/split_part.sql b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/split_part.sql new file mode 100644 index 0000000..b476e05 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/cross_db_utils/split_part.sql @@ -0,0 +1,23 @@ +{% macro spark__split_part(string_text, delimiter_text, part_number) %} + + {% set delimiter_expr %} + + -- escape if starts with a special character + case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_' + then concat('\\', {{ delimiter_text }}) + else {{ delimiter_text }} end + + {% endset %} + + {% set split_part_expr %} + + split( + {{ string_text }}, + {{ delimiter_expr }} + )[({{ part_number - 1 }})] + + {% endset %} + + {{ return(split_part_expr) }} + +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/dbt_utils/sql/get_relations_by_prefix.sql b/dbt_packages/spark_utils/macros/dbt_utils/sql/get_relations_by_prefix.sql new file mode 100644 index 0000000..cb875e7 --- /dev/null +++ b/dbt_packages/spark_utils/macros/dbt_utils/sql/get_relations_by_prefix.sql @@ -0,0 +1,41 @@ +{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %} + + {%- call statement('get_tables', fetch_result=True) %} + + show table extended in {{ schema_pattern }} like '{{ table_pattern }}' + + {%- endcall -%} + + {%- set table_list = load_result('get_tables') -%} + + {%- if table_list and table_list['table'] -%} + {%- set tbl_relations = [] -%} + {%- for row in table_list['table'] -%} + {%- set tbl_relation = api.Relation.create( + database=None, + schema=row[0], + identifier=row[1], + type=('view' if 'Type: VIEW' in row[3] else 'table') + ) -%} + {%- do tbl_relations.append(tbl_relation) -%} + {%- endfor -%} + + {{ return(tbl_relations) }} + {%- else -%} + {{ return([]) }} + {%- endif -%} + +{% endmacro %} + +{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %} + {% set table_pattern = table_pattern ~ '*' %} + {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }} +{% endmacro %} + +{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %} + {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }} +{% endmacro %} + +{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %} + {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }} +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/etc/assert_not_null.sql b/dbt_packages/spark_utils/macros/etc/assert_not_null.sql new file mode 100644 index 0000000..e4692de --- /dev/null +++ b/dbt_packages/spark_utils/macros/etc/assert_not_null.sql @@ -0,0 +1,9 @@ +{% macro assert_not_null(function, arg) -%} + {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }} +{%- endmacro %} + +{% macro default__assert_not_null(function, arg) %} + + coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null)) + +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/maintenance_operation.sql b/dbt_packages/spark_utils/macros/maintenance_operation.sql new file mode 100644 index 0000000..5c731e6 --- /dev/null +++ b/dbt_packages/spark_utils/macros/maintenance_operation.sql @@ -0,0 +1,104 @@ +{% macro get_tables(table_regex_pattern='.*') %} + + {% set tables = [] %} + {% for database in spark__list_schemas('not_used') %} + {% for table in spark__list_relations_without_caching(database[0]) %} + {% set db_tablename = database[0] ~ "." ~ table[1] %} + {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %} + {% if is_match %} + {% call statement('table_detail', fetch_result=True) -%} + describe extended {{ db_tablename }} + {% endcall %} + + {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %} + {% if table_type[1]|lower != 'view' %} + {{ tables.append(db_tablename) }} + {% endif %} + {% endif %} + {% endfor %} + {% endfor %} + {{ return(tables) }} + +{% endmacro %} + +{% macro get_delta_tables(table_regex_pattern='.*') %} + + {% set delta_tables = [] %} + {% for db_tablename in get_tables(table_regex_pattern) %} + {% call statement('table_detail', fetch_result=True) -%} + describe extended {{ db_tablename }} + {% endcall %} + + {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %} + {% if table_type[1]|lower == 'delta' %} + {{ delta_tables.append(db_tablename) }} + {% endif %} + {% endfor %} + {{ return(delta_tables) }} + +{% endmacro %} + +{% macro get_statistic_columns(table) %} + + {% call statement('input_columns', fetch_result=True) %} + SHOW COLUMNS IN {{ table }} + {% endcall %} + {% set input_columns = load_result('input_columns').table %} + + {% set output_columns = [] %} + {% for column in input_columns %} + {% call statement('column_information', fetch_result=True) %} + DESCRIBE TABLE {{ table }} `{{ column[0] }}` + {% endcall %} + {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %} + {{ output_columns.append('`' ~ column[0] ~ '`') }} + {% endif %} + {% endfor %} + {{ return(output_columns) }} + +{% endmacro %} + +{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %} + + {% for table in get_delta_tables(table_regex_pattern) %} + {% set start=modules.datetime.datetime.now() %} + {% set message_prefix=loop.index ~ " of " ~ loop.length %} + {{ dbt_utils.log_info(message_prefix ~ " Optimizing " ~ table) }} + {% do run_query("optimize " ~ table) %} + {% set end=modules.datetime.datetime.now() %} + {% set total_seconds = (end - start).total_seconds() | round(2) %} + {{ dbt_utils.log_info(message_prefix ~ " Finished " ~ table ~ " in " ~ total_seconds ~ "s") }} + {% endfor %} + +{% endmacro %} + +{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %} + + {% for table in get_delta_tables(table_regex_pattern) %} + {% set start=modules.datetime.datetime.now() %} + {% set message_prefix=loop.index ~ " of " ~ loop.length %} + {{ dbt_utils.log_info(message_prefix ~ " Vacuuming " ~ table) }} + {% do run_query("vacuum " ~ table) %} + {% set end=modules.datetime.datetime.now() %} + {% set total_seconds = (end - start).total_seconds() | round(2) %} + {{ dbt_utils.log_info(message_prefix ~ " Finished " ~ table ~ " in " ~ total_seconds ~ "s") }} + {% endfor %} + +{% endmacro %} + +{% macro spark_analyze_tables(table_regex_pattern='.*') %} + + {% for table in get_tables(table_regex_pattern) %} + {% set start=modules.datetime.datetime.now() %} + {% set columns = get_statistic_columns(table) | join(',') %} + {% set message_prefix=loop.index ~ " of " ~ loop.length %} + {{ dbt_utils.log_info(message_prefix ~ " Analyzing " ~ table) }} + {% if columns != '' %} + {% do run_query("analyze table " ~ table ~ " compute statistics for columns " ~ columns) %} + {% endif %} + {% set end=modules.datetime.datetime.now() %} + {% set total_seconds = (end - start).total_seconds() | round(2) %} + {{ dbt_utils.log_info(message_prefix ~ " Finished " ~ table ~ " in " ~ total_seconds ~ "s") }} + {% endfor %} + +{% endmacro %} diff --git a/dbt_packages/spark_utils/macros/snowplow/convert_timezone.sql b/dbt_packages/spark_utils/macros/snowplow/convert_timezone.sql new file mode 100644 index 0000000..8fc335d --- /dev/null +++ b/dbt_packages/spark_utils/macros/snowplow/convert_timezone.sql @@ -0,0 +1,3 @@ +{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %} + from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}}) +{% endmacro %} diff --git a/dbt_project.yml b/dbt_project.yml index b7041f3..73c3846 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,30 +1,28 @@ - # Name your project! Project names should contain only lowercase characters # and underscores. A good package name should reflect your organization's # name or the intended use of these models -name: 'snowflake_fivetran_vhol' -version: '1.0.0' +name: "snowflake_fivetran_vhol" +version: "1.0.0" config-version: 2 # This setting configures which "profile" dbt uses for this project. -profile: 'default' +profile: "default" # These configurations specify where dbt should look for different types of files. -# The `source-paths` config, for example, states that models in this project can be +# The `model-paths` config, for example, states that models in this project can be # found in the "models/" directory. You probably won't need to change these! -source-paths: ["models"] +model-paths: ["models"] analysis-paths: ["analysis"] test-paths: ["tests"] -data-paths: ["data"] +seed-paths: ["data"] macro-paths: ["macros"] snapshot-paths: ["snapshots"] -target-path: "target" # directory which will store compiled SQL files -clean-targets: # directories to be removed by `dbt clean` +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` - "target" - "dbt_modules" - # Configuring models # Full documentation: https://docs.getdbt.com/docs/configuring-models @@ -38,4 +36,4 @@ clean-targets: # directories to be removed by `dbt clean` # materialized: view vars: - google_ads_schema: 'GOOGLE_ADS_DEMO' + google_ads_schema: "GOOGLE_ADS_DEMO" diff --git a/deployment.yml b/deployment.yml index b6d0dce..467d861 100644 --- a/deployment.yml +++ b/deployment.yml @@ -1,27 +1,26 @@ jobs: -# Give each job a unique name. The name will be displayed in the Fivetran dashboard once your jobs are imported. - - name: daily - schedule: 0 12 * * * # Define when this job should run, using cron format. This example will run every day at 12:00pm (according to your warehouse timezone). For help with cron formatting, visit https://crontab.guru/. - steps: - - name: run models # Give each step in your job a name. This will enable you to track the steps in the logs. - command: dbt run # Enter the dbt command that should run in this step. This example will run all your models. For a list of available commands visit https://docs.getdbt.com/reference/model-selection-syntax/. - - name: test models - command: dbt test # This example will run all your tests. + # Give each job a unique name. The name will be displayed in the Fivetran dashboard once your jobs are imported. + - name: daily + schedule: 0 12 * * * # Define when this job should run, using cron format. This example will run every day at 12:00pm (according to your warehouse timezone). For help with cron formatting, visit https://crontab.guru/. + steps: + - name: run models # Give each step in your job a name. This will enable you to track the steps in the logs. + command: dbt run # Enter the dbt command that should run in this step. This example will run all your models. For a list of available commands visit https://docs.getdbt.com/reference/model-selection-syntax/. + - name: test models + command: dbt test # This example will run all your tests. -# - name: nightly -# schedule: 0 0 * * * # This example will run every day at midnight. -# steps: -# - name: run models -# command: dbt run --models my_first_model my_second_model # This example will run two specific models. - - - name: weekdays - schedule: 30 7 * * 1-5 # The example will run every weekday at 7:30am. - steps: - - name: run models - command: dbt run + # - name: nightly + # schedule: 0 0 * * * # This example will run every day at midnight. + # steps: + # - name: run models + # command: dbt run --models my_first_model my_second_model # This example will run two specific models. + - name: weekdays + schedule: 30 7 * * 1-5 # The example will run every weekday at 7:30am. + steps: + - name: run models + command: dbt run # - name: every5minutes # schedule: '*/5 * * * *' # The example will run every 5 minutes. Note that the cron string is quoted as otherwise it will be treated as invalid alias node (see https://yaml.org/spec/1.2/spec.html#*%20alias// for details) # steps: # - name: run models -# command: dbt run \ No newline at end of file +# command: dbt run diff --git a/packages.yml b/packages.yml index 687a4fa..01f0df2 100644 --- a/packages.yml +++ b/packages.yml @@ -1,7 +1,6 @@ packages: - - package: fivetran/google_ads_source - version: 0.1.0 + version: 0.7.0 - package: fivetran/google_ads - version: 0.1.0 + version: 0.7.0