diff --git a/.claude/design_patterns.md b/.claude/design_patterns.md index 2ea8c52..133af7a 100644 --- a/.claude/design_patterns.md +++ b/.claude/design_patterns.md @@ -71,6 +71,9 @@ authoritative; grep it. - [Collapsible node-page sections (`nodeSection`)](#collapsible-node-page-sections-nodesection) - [Theory](#theory-19) - [Example](#example-19) + - [Opt-in artifact-source plugin (info\_schema)](#opt-in-artifact-source-plugin-info_schema) + - [Theory](#theory-20) + - [Example](#example-20) ## Pipeline-stage package layout @@ -81,7 +84,10 @@ The package is grouped by what each module does in the generate pipeline: `extract/` (derive the documentation data from artifacts: nodes, ERDs, node-level graph, column-level lineage) → `site/` (assemble + publish: the data dict builder, the external gzip payload, versioned deploy, and the bundled SPA). -The CLI (`cli/`) wires user commands to `site/`. Dependencies flow one way: +`sources/` holds opt-in artifact sources (`--info-schema`) that wrap `site/`'s +`ReportBuilder` (see **Opt-in artifact-source plugin**). The CLI (`cli/`) wires user +commands to `site/`: it picks the builder with `sources.factory.builder_for` and +hands it to `site.deploy.deploy(builder=...)`, so `site/` never imports `sources/`. `extract/` and `site/` import from `core/`, never the reverse. ### Example @@ -101,6 +107,8 @@ from dbdocs.site.inject import strip_marker - `dbdocs/extract/` — `nodes.py`, `erd.py`, `graph.py`, `column_lineage.py` - `dbdocs/site/` — `builder.py`, `inject.py`, `deploy.py`, `bundle/` (the SPA: `index.html` + `assets/{js,css,vendor,graph}/`) +- `dbdocs/sources/` — `factory.py` (`builder_for`), `info_schema/` + (`reader.py`, `synth.py`, `builder.py`) - `frontend/` — the React Flow graph app (React+TS, Vite), built into the committed `dbdocs/site/bundle/assets/graph/`; `src/{components,lib}`, `test/{unit,e2e}`, `@/*`→`src/*` path alias @@ -248,7 +256,11 @@ def _resolve_within_cwd(value: str, field_name: str) -> Path: All dbt-artifact access goes through `dbdocs/core/artifacts.py`: `load_artifacts` returns dbterd-parsed `(manifest, catalog)` with schema-version relaxation; `adapter_type` reads the warehouse from metadata (the default sqlglot dialect). -**Critical:** `artifact_parser` aliases the `schema` field to `schema_` to +`catalog.json` is **optional** — dbt 2.0's `docs generate` doesn't write it — so +a missing file yields `catalog=None` (with a warning) and every consumer reads it +defensively (`getattr(catalog, "nodes", {}) or {}`), falling back to the manifest +per **Manifest-base columns, catalog-enriched**. Don't make a catalog-only code +path that dereferences it unguarded. **Critical:** `artifact_parser` aliases the `schema` field to `schema_` to avoid clobbering Pydantic's `BaseModel.schema()`, so `entity.schema` is a *bound method*, not the value. Always read `schema_`; `db_schema(entity)` centralizes that with safe `_unknown` fallbacks. Never read `.schema` off a parsed node. @@ -741,7 +753,7 @@ def _validate_segment(value: str, kind: str) -> None: _validate_segment(version, "version") if alias is not None: _validate_segment(alias, "alias") -ReportBuilder(config).generate(output_dir=str(version_dir), versioned=True) +(builder or ReportBuilder(config)).generate(output_dir=str(version_dir), versioned=True) # dbdocs/site/builder.py — generate() writes the flag into metadata data["metadata"]["versioned"] = versioned # False by default, True from deploy() @@ -1443,3 +1455,64 @@ All other renderer types follow the same open-if-non-empty / always-open-for-pri - `dbdocs/site/bundle/assets/js/ui/ui.js` — `nodeSection`, `sectionLinkButton`, `_getSectionOpen`, `_setSectionOpen`, `_loadSectionState`, `_saveSectionState`, `expandCollapseBtn`, `focusSection`, `_forceNodeSectionOpen`, `_initSectionObserver` (scroll-spy + `sectionObserverRefresh`), `_depSection`, `_appendDepsSections`, `_physicalDetailsSection`, `_columnsSection`, `_testsSection`, `_erdSection`, `_sqlSection`, `renderPhysicalNode`, `renderCodeOnlyNode`, `renderMetricNode`, `renderSemanticModelNode`, `renderSavedQueryNode`, `renderUnitTestNode`, `renderExposureNode` - `dbdocs/site/bundle/assets/js/service/service.js` — `columnCount`, `macroCount` - `dbdocs/site/bundle/assets/css/style.css` — `details.node-section`, `.node-section-summary`, `.node-section-title`, `.node-section-count`, `.node-section-summary-actions`, `.section-link-btn`, `.section-in-view`, `.node-section-body`, `.expand-collapse-btn`, `.erd-section-host`, `@media print` + +## Opt-in artifact-source plugin (info\_schema) + +### Theory + +dbt 2.0 writes a versioned parquet information schema (`target/info_schema/v1/*.parquet`, +public contract `dbt.*` + `dbt_rt.*`). `--info-schema` (or `info_schema: true`) makes it +the **base** artifact source, with any `manifest.json` / `catalog.json` / +`run_results.json` present as **enrichment**. The plugin does not add a second render +path: it synthesizes standard manifest v12 / catalog v1 / run_results v6 into a temp +staging dir and runs the **unchanged** `ReportBuilder.build_data` on it, so every +extractor, dbterd and the API tree stay untouched. `builder_for(config)` +(`dbdocs/sources/factory.py`) is the only switch: flag off returns a plain +`ReportBuilder` (same code path, same output); flag on loads +`dbdocs.sources.info_schema.builder` through `importlib.import_module`, so DuckDB stays an +optional extra (`dbdocs[info-schema]`) without an in-function import, and a +`ModuleNotFoundError` for `duckdb` (only — any other missing module re-raises) +becomes `DbDocsConfigError`. The CLI calls `builder_for` for both `generate` and +`deploy` and passes the result into `deploy(builder=...)`; `site/` never imports +`sources/`. + +One merge rule, applied per record and field in `synth.py`: the parquet set decides +which records exist, a non-empty parquet value wins, and the matching JSON record fills +what parquet left empty. Column types are the exception: catalog.json type, then +`data_type_actual`, then the declared type, then `data_type_inferred` (Arrow form such as +`Int64`, weaker than a warehouse type). Staged unit-test checksums are flattened to a +string because v12 declares a string while dbt 2.0 emits an object. Parquet keeps run +history, so `build_run_results` takes the latest invocation that contains tests rather +than the last (possibly test-less) `run_results.json`. + +After the base build, `columnLineage` is replaced by `dbt.column_lineage` when it has value +rows (parent to child, remapped to `{"node.col": [{node, column}]}`, deduplicated and sorted +by `(node, column)`); an empty table keeps the sqlglot result. Only **value lineage** is +kept: rows with `evolution = "scan"` (`_READ_ONLY_EVOLUTIONS` — a join, filter or grouping +key that is read but doesn't feed the column's value) are dropped, so the lineage means the +same thing as the sqlglot path's. Don't count `scan` rows as lineage. `metadata.artifact_source` is `"info_schema"`. An explicit opt-in with a +missing directory or an unsupported `dbt.project.schema_version` raises +`DbDocsConfigError` instead of silently falling back to JSON. + +### Example + +```python +# dbdocs/sources/factory.py +if not config.info_schema: + return ReportBuilder(config) +module = importlib.import_module(INFO_SCHEMA_BUILDER_MODULE) +return module.InfoSchemaReportBuilder(config) + +# dbdocs/sources/info_schema/builder.py +staged = ReportBuilder(replace(self.config, target_dir=staging, run_results=None)) +data = staged.build_data() +``` + +- `dbdocs/sources/factory.py` — `builder_for` +- `dbdocs/sources/info_schema/builder.py` — `InfoSchemaReportBuilder` +- `dbdocs/sources/info_schema/reader.py` — `InfoSchemaReader` +- `dbdocs/sources/info_schema/synth.py` — `build_manifest`, `build_catalog`, `build_run_results`, `column_lineage`, `_READ_ONLY_EVOLUTIONS`, `_fill`; JSON-text columns decode through artifact-parser's `decode_json_column` (one definition — don't re-add a local copy) +- `dbdocs/core/config.py` — `info_schema`, `info_schema_dir`, `info_schema_path` +- `dbdocs/cli/main.py` — `info_schema_options`, `_apply_info_schema` (on `generate` and `deploy`), `builder_for(config)` passed as `deploy(builder=...)` +- `dbdocs/site/deploy.py` — `def deploy` (`builder` parameter, default `ReportBuilder(config)`) +- `tests/fixtures/jaffle_shop_v2/` — dbt Fusion 2.0.11 `--generate-info-schema` output (parquet + manifest + run_results, no catalog) diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml index 2ecf0a9..98bb459 100644 --- a/.github/workflows/ci_pr.yml +++ b/.github/workflows/ci_pr.yml @@ -54,7 +54,7 @@ jobs: run: uv run pytest --cov=dbdocs --cov-report=term-missing --cov-fail-under=100 e2e: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 diff --git a/CLAUDE.md b/CLAUDE.md index 2bed3c6..ee72394 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,13 +34,17 @@ dbt-docs/ │ ├── core/ # foundation: config, artifacts, exceptions, log │ ├── extract/ # derive doc data from artifacts: │ │ # nodes, erd, graph, column_lineage (sqlglot) -│ └── site/ # assemble + publish: -│ ├── builder.py # ReportBuilder — the one data dict + generate -│ ├── inject.py # strip_marker (data is external, not inlined) -│ ├── deploy.py # versioned deploy (no mike) -│ └── bundle/ # the SPA: index.html + assets/{js,css,vendor,graph}/ -│ # js/ = 3-tier ES modules (data→service→ui) -│ # graph/ = committed React Flow bundle +│ ├── site/ # assemble + publish: +│ │ ├── builder.py # ReportBuilder — the one data dict + generate +│ │ ├── inject.py # strip_marker (data is external, not inlined) +│ │ ├── deploy.py # versioned deploy (no mike) +│ │ └── bundle/ # the SPA: index.html + assets/{js,css,vendor,graph}/ +│ │ # js/ = 3-tier ES modules (data→service→ui) +│ │ # graph/ = committed React Flow bundle +│ └── sources/ # opt-in artifact sources wrapping ReportBuilder: +│ ├── factory.py # builder_for(config) — the one switch +│ └── info_schema/ # --info-schema: dbt 2.0 parquet → staged JSON +│ # (reader, synth, builder; DuckDB extra) ├── frontend/ # React Flow graph app (React+TS, Vite) → │ # built into dbdocs/site/bundle/assets/graph/ (committed) │ # src/{components,lib}, test/{unit,e2e}, @/*→src/* @@ -51,7 +55,8 @@ dbt-docs/ ``` It's a flat single-package layout — `dbdocs/` lives at the repo root (no `src/`). -The package is grouped by pipeline stage: `core/` → `extract/` → `site/`. +The package is grouped by pipeline stage: `core/` → `extract/` → `site/`, with +`sources/` as opt-in artifact sources that wrap `site/`'s `ReportBuilder`. ## Workflows diff --git a/README.md b/README.md index 50ff373..60b80e5 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,20 @@ Requires Python 3.10+. ```bash dbt docs generate # writes target/manifest.json + target/catalog.json -dbdocs generate # builds ./site/ with index.html + dbdocs-data.json.gz +dbdocs generate # builds target/site/ with index.html + dbdocs-data.json.gz dbdocs serve # static http server on http://127.0.0.1:8000 ``` The site must be served over HTTP (not opened as a local file) because it fetches the data payload at load time. `dbdocs serve` handles that locally; any static host works for deployment. +### On dbt 2.0 + +dbt 2.0 stops writing `catalog.json` and can write a typed parquet **information schema** instead — on dbt Fusion with `--static-analysis strict`, complete with column types and dbt's own column-level lineage. dbdocs builds from either; to read the info schema, `pip install "dbdocs[info-schema]"` and set `info_schema: true` in `dbdocs.yml`: + +![dbt Fusion writes the info schema, dbdocs builds and serves the site from it](docs/assets/img/dbt-2-info-schema.gif) + +The [dbt 2.0 & Info Schema](https://dbdocs.datnguye.me/latest/nav/guide/dbt-2-info-schema.html) guide walks through it. + Full walkthrough, configuration, and architecture live in the **[documentation](https://dbdocs.datnguye.me/)**. ## Contributing diff --git a/dbdocs.yml.example b/dbdocs.yml.example index e7a8ca5..fe7bc22 100644 --- a/dbdocs.yml.example +++ b/dbdocs.yml.example @@ -113,6 +113,13 @@ default_version: latest # # ship rules via the `dbdocs.health_rules` entry-point group. # # rules_module: my_project.dbdocs_health_rules +# Opt in to dbt 2.0's parquet information schema as the base artifact source +# (needs `pip install 'dbdocs[info-schema]'`). manifest.json / catalog.json / +# run_results.json in target_dir then only enrich it. Also --info-schema on the CLI. +# info_schema: false +# Directory of the parquet files; default /info_schema/v1. +# info_schema_dir: target/info_schema/v1 + # The pinned About link shows by default; set false to hide it. show_about: true diff --git a/dbdocs/cli/main.py b/dbdocs/cli/main.py index ef30940..4c8eaae 100644 --- a/dbdocs/cli/main.py +++ b/dbdocs/cli/main.py @@ -9,11 +9,31 @@ from dbdocs.core.exceptions import DbDocsError from dbdocs.core.log import logger from dbdocs.site import deploy as deploy_module -from dbdocs.site.builder import ReportBuilder +from dbdocs.sources.factory import builder_for __version__ = importlib.metadata.version("dbdocs") +def info_schema_options(command): + command = click.option( + "--info-schema-dir", + default=None, + help="Directory of the info-schema parquet files (default: /info_schema/v1).", + )(command) + return click.option( + "--info-schema/--no-info-schema", + default=None, + help="Read dbt 2.0's parquet information schema as the base artifact source.", + )(command) + + +def _apply_info_schema(config: DbDocsConfig, info_schema, info_schema_dir) -> None: + if info_schema is not None: + config.info_schema = info_schema + if info_schema_dir is not None: + config.info_schema_dir = info_schema_dir + + # dbdocs @click.group( context_settings={"help_option_names": ["-h", "--help"]}, @@ -37,6 +57,7 @@ def dbdocs(ctx, config_path): @dbdocs.command(name="generate") +@info_schema_options @click.option("-o", "--output-dir", default=None, help="Where to write the site (default: config).") @click.option( "--dialect", default=None, help="SQL dialect for column lineage (default: adapter_type)." @@ -49,14 +70,15 @@ def dbdocs(ctx, config_path): ), ) @click.pass_obj -def generate(config: DbDocsConfig, output_dir, dialect, run_results): +def generate(config: DbDocsConfig, output_dir, dialect, run_results, info_schema, info_schema_dir): """Build the site from dbt artifacts (served over HTTP; data loaded externally).""" if dialect is not None: config.dialect = dialect if run_results is not None: config.run_results = run_results + _apply_info_schema(config, info_schema, info_schema_dir) try: - ReportBuilder(config).generate(output_dir=output_dir) + builder_for(config).generate(output_dir=output_dir) except DbDocsError as exc: raise click.ClickException(str(exc)) from exc # The builder already logs "Generated site at (N nodes, M edges)". @@ -84,15 +106,24 @@ def serve(config: DbDocsConfig, port): "--delete", "delete", is_flag=True, default=False, help="Delete this version instead." ) @click.option("--push/--no-push", default=False, help="Publish to the gh-pages branch.") +@info_schema_options @click.pass_obj -def deploy(config: DbDocsConfig, version, alias, title, delete, push): +def deploy(config: DbDocsConfig, version, alias, title, delete, push, info_schema, info_schema_dir): """Generate a versioned build and update the version index (or --delete one).""" + _apply_info_schema(config, info_schema, info_schema_dir) try: if delete: deploy_module.delete(config, version=version, push=push) click.echo(f"Deleted version {version}") return - out = deploy_module.deploy(config, version=version, alias=alias, push=push, title=title) + out = deploy_module.deploy( + config, + version=version, + alias=alias, + push=push, + title=title, + builder=builder_for(config), + ) except DbDocsError as exc: raise click.ClickException(str(exc)) from exc click.echo(f"Deployed version {version} into {out}") diff --git a/dbdocs/core/artifacts.py b/dbdocs/core/artifacts.py index 8558c25..bd445b0 100644 --- a/dbdocs/core/artifacts.py +++ b/dbdocs/core/artifacts.py @@ -19,6 +19,8 @@ from dbterd.helpers import file +from dbdocs.core.log import logger + #: Bucket label used when a node/source has no database or schema set. UNKNOWN = "_unknown" @@ -54,10 +56,23 @@ def artifact_version(target_path: str, artifact: str) -> "int | None": def load_artifacts(target_path: str) -> "tuple[Any, Any]": - """Return the dbterd-parsed ``(manifest, catalog)`` for a dbt target dir.""" + """Return the dbterd-parsed ``(manifest, catalog)`` for a dbt target dir. + + ``catalog.json`` is optional (dbt 2.0's ``docs generate`` does not write it): + when absent, ``catalog`` is ``None`` and every consumer falls back to the + manifest — columns lose their warehouse type and column-level lineage can't + resolve ``SELECT *`` / unqualified columns. + """ manifest = file.read_manifest( path=target_path, version=artifact_version(target_path, "manifest") ) + if not (Path(target_path) / "catalog.json").is_file(): + logger.warning( + "No catalog.json in %s — building from the manifest only " + "(no warehouse column types; reduced column-level lineage).", + target_path, + ) + return manifest, None catalog = file.read_catalog(path=target_path, version=artifact_version(target_path, "catalog")) return manifest, catalog diff --git a/dbdocs/core/config.py b/dbdocs/core/config.py index 386673e..777ee29 100644 --- a/dbdocs/core/config.py +++ b/dbdocs/core/config.py @@ -81,6 +81,13 @@ class DbDocsConfig: #: dotted import path whose ``register_rule`` calls add custom rules). Entry #: points under ``dbdocs.health_rules`` are also discovered automatically. health: dict = field(default_factory=dict) + #: Opt in to reading dbt 2.0's parquet information schema as the base artifact + #: source (``manifest.json`` / ``catalog.json`` / ``run_results.json`` in + #: ``target_dir`` then only enrich it). Needs ``dbdocs[info-schema]``. + info_schema: bool = False + #: Directory holding the information-schema parquet files; ``None`` ⇒ + #: ``/info_schema/v1``. + info_schema_dir: "str | None" = None #: The pinned About link shows by default; set false to hide it. show_about: bool = True #: Links rendered on the About page as external CTA buttons. Each entry is a @@ -129,6 +136,8 @@ def load(cls, path: "str | Path | None" = None) -> "DbDocsConfig": "favicon", "run_results", "health", + "info_schema", + "info_schema_dir", ) def render_context(self) -> dict: @@ -164,3 +173,10 @@ def output_path(self) -> str: A relative path that would escape the cwd raises ``DbDocsConfigError``. """ return str(_resolve_within_cwd(self.output_dir, "output_dir")) + + @property + def info_schema_path(self) -> str: + """Directory of the information-schema parquet files (see ``info_schema_dir``).""" + if self.info_schema_dir: + return str(_resolve_within_cwd(self.info_schema_dir, "info_schema_dir")) + return str(Path(self.target_path) / "info_schema" / "v1") diff --git a/dbdocs/extract/column_lineage.py b/dbdocs/extract/column_lineage.py index bbba444..9e8c06a 100644 --- a/dbdocs/extract/column_lineage.py +++ b/dbdocs/extract/column_lineage.py @@ -61,10 +61,11 @@ def _leaf_columns(root: Node, relation_to_node: dict) -> list: """Collect distinct upstream ``{node, column}`` leaves of a lineage tree. A leaf is a node whose source is a real ``Table`` (not a CTE/subquery scope) - that maps back to a dbt node. The root itself is skipped. + that maps back to a dbt node. The root itself is skipped. Leaves are sorted + by ``(node, column)``: the tree's walk order follows sqlglot's internal set + iteration, which varies with ``PYTHONHASHSEED``. """ - seen = set() - upstream = [] + leaves = set() for node in root.walk(): if node is root: continue @@ -72,15 +73,9 @@ def _leaf_columns(root: Node, relation_to_node: dict) -> list: if not isinstance(source, exp.Table): continue mapped = _map_table(source, relation_to_node) - if mapped is None: - continue - column = node_name(node.name) - key = (mapped, column) - if key in seen: - continue - seen.add(key) - upstream.append({"node": mapped, "column": column}) - return upstream + if mapped is not None: + leaves.add((mapped, node_name(node.name))) + return [{"node": mapped, "column": column} for mapped, column in sorted(leaves)] def _extract_model_columns( diff --git a/dbdocs/site/deploy.py b/dbdocs/site/deploy.py index cb32daf..b7ca271 100644 --- a/dbdocs/site/deploy.py +++ b/dbdocs/site/deploy.py @@ -67,8 +67,14 @@ def deploy( alias: "str | None" = None, push: bool = False, title: "str | None" = None, + builder: "ReportBuilder | None" = None, ) -> str: - """Generate ``version`` into the output root and update the version index.""" + """Generate ``version`` into the output root and update the version index. + + ``builder`` renders the version; the CLI passes ``sources.factory.builder_for``'s + pick so an opt-in artifact source applies, keeping ``site/`` free of ``sources/``. + It defaults to a plain ``ReportBuilder``. + """ _validate_segment(version, "version") if alias is not None: _validate_segment(alias, "alias") @@ -77,7 +83,7 @@ def deploy( if version_dir.exists(): rmtree(version_dir) - ReportBuilder(config).generate(output_dir=str(version_dir), versioned=True) + (builder or ReportBuilder(config)).generate(output_dir=str(version_dir), versioned=True) versions = _upsert_version(_read_versions(output_root), version, title or version, alias) (output_root / VERSIONS_FILE).write_text(json.dumps(versions, indent=2), encoding="utf-8") diff --git a/dbdocs/sources/__init__.py b/dbdocs/sources/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dbdocs/sources/factory.py b/dbdocs/sources/factory.py new file mode 100644 index 0000000..3e133bc --- /dev/null +++ b/dbdocs/sources/factory.py @@ -0,0 +1,24 @@ +"""Pick the report builder for the configured artifact source.""" + +import importlib + +from dbdocs.core.config import DbDocsConfig +from dbdocs.core.exceptions import DbDocsConfigError +from dbdocs.site.builder import ReportBuilder + +INFO_SCHEMA_BUILDER_MODULE = "dbdocs.sources.info_schema.builder" + + +def builder_for(config: DbDocsConfig) -> ReportBuilder: + """``ReportBuilder`` for the JSON artifacts; the info-schema builder when opted in.""" + if not config.info_schema: + return ReportBuilder(config) + try: + module = importlib.import_module(INFO_SCHEMA_BUILDER_MODULE) + except ModuleNotFoundError as exc: + if exc.name != "duckdb": + raise + raise DbDocsConfigError( + "info_schema needs DuckDB: install it with `pip install 'dbdocs[info-schema]'`." + ) from exc + return module.InfoSchemaReportBuilder(config) diff --git a/dbdocs/sources/info_schema/__init__.py b/dbdocs/sources/info_schema/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dbdocs/sources/info_schema/builder.py b/dbdocs/sources/info_schema/builder.py new file mode 100644 index 0000000..a2834a2 --- /dev/null +++ b/dbdocs/sources/info_schema/builder.py @@ -0,0 +1,65 @@ +"""Report builder that reads dbt 2.0's parquet information schema.""" + +import json +import tempfile +from dataclasses import replace +from pathlib import Path + +from dbdocs.core.config import DbDocsConfig +from dbdocs.core.log import logger +from dbdocs.site.builder import ReportBuilder +from dbdocs.sources.info_schema import synth +from dbdocs.sources.info_schema.reader import InfoSchemaReader + +ARTIFACT_SOURCE = "info_schema" + + +def _read_json(path: Path) -> "dict | None": + """An optional JSON enrichment artifact; ``None`` when absent or unusable (logged).""" + try: + return json.loads(path.read_text(encoding="utf-8")) + except FileNotFoundError: + return None + except (OSError, json.JSONDecodeError) as exc: + logger.warning("Ignoring %s as info_schema enrichment: %s", path, exc) + return None + + +class InfoSchemaReportBuilder(ReportBuilder): + """Stages synthesized artifacts, then runs the unchanged ``build_data`` on them. + + Parquet is the base; ``manifest.json`` / ``catalog.json`` / ``run_results.json`` + in ``target_dir`` enrich it when present. ``dbt.column_lineage`` rows replace + the sqlglot column lineage; an empty table keeps the sqlglot result. + """ + + def __init__(self, config: DbDocsConfig) -> None: + super().__init__(config) + self.reader = InfoSchemaReader(config.info_schema_path) + + def build_data(self) -> dict: + target = Path(self.config.target_path) + run_results = _read_json(Path(self._resolve_run_results_path())) + with tempfile.TemporaryDirectory() as staging: + self._stage(Path(staging), target, run_results) + staged = ReportBuilder(replace(self.config, target_dir=staging, run_results=None)) + data = staged.build_data() + data["metadata"]["artifact_source"] = ARTIFACT_SOURCE + lineage = synth.column_lineage(self.reader) + if lineage: + data["columnLineage"] = lineage + else: + logger.info("dbt.column_lineage is empty — keeping sqlglot column lineage.") + return data + + def _stage(self, staging: Path, target: Path, run_results: "dict | None") -> None: + artifacts = { + "manifest": synth.build_manifest(self.reader, _read_json(target / "manifest.json")), + "catalog": synth.build_catalog(self.reader, _read_json(target / "catalog.json")), + "run_results": synth.build_run_results(self.reader, run_results), + } + for name, artifact in artifacts.items(): + if artifact is not None: + (staging / f"{name}.json").write_text( + json.dumps(artifact, default=str), encoding="utf-8" + ) diff --git a/dbdocs/sources/info_schema/reader.py b/dbdocs/sources/info_schema/reader.py new file mode 100644 index 0000000..9c4780b --- /dev/null +++ b/dbdocs/sources/info_schema/reader.py @@ -0,0 +1,45 @@ +"""Read dbt 2.0's parquet information schema (``dbt.*`` / ``dbt_rt.*`` tables).""" + +from pathlib import Path + +import duckdb + +from dbdocs.core.exceptions import DbDocsConfigError + +SUPPORTED_SCHEMA_VERSION = 1 + + +class InfoSchemaReader: + """Rows of the information-schema parquet files under ``directory``. + + A table with no parquet file reads as ``[]``. Construction fails unless the + directory exists and ``dbt.project.schema_version`` is the supported one. + """ + + def __init__(self, directory: "str | Path") -> None: + self.directory = Path(directory) + self._tables: dict[str, list[dict]] = {} + if not self.directory.is_dir(): + raise DbDocsConfigError(f"info_schema directory not found: {self.directory}") + project = self.table("dbt.project") + version = project[0].get("schema_version") if project else None + if version != SUPPORTED_SCHEMA_VERSION: + raise DbDocsConfigError( + f"Unsupported info_schema schema_version {version!r} in {self.directory} " + f"(supported: {SUPPORTED_SCHEMA_VERSION})." + ) + + def table(self, name: str) -> "list[dict]": + """The table's rows, read once per reader and served from memory after.""" + if name not in self._tables: + self._tables[name] = self._read(self.directory / f"{name}.parquet") + return self._tables[name] + + @staticmethod + def _read(path: Path) -> "list[dict]": + if not path.is_file(): + return [] + with duckdb.connect() as connection: + cursor = connection.execute("SELECT * FROM read_parquet(?)", [str(path)]) + columns = [col[0] for col in cursor.description] + return [dict(zip(columns, row, strict=True)) for row in cursor.fetchall()] diff --git a/dbdocs/sources/info_schema/synth.py b/dbdocs/sources/info_schema/synth.py new file mode 100644 index 0000000..3aa0d66 --- /dev/null +++ b/dbdocs/sources/info_schema/synth.py @@ -0,0 +1,604 @@ +"""Synthesize standard dbt artifacts (manifest v12 / catalog v1 / run_results v6) +from the parquet information schema. + +Merge rule, applied per record and field: the parquet set decides which records +exist, a non-empty parquet value wins, and the matching JSON artifact record (when +one was supplied) fills whatever parquet left empty. Column types are the one +exception: warehouse ``catalog.json`` type, then ``data_type_actual``, then the +declared type, then ``data_type_inferred``. +""" + +from collections import defaultdict +from datetime import datetime, timezone +from typing import Any + +from artifact_parser.dbt_info_schema.base import decode_json_column + +from dbdocs.sources.info_schema.reader import InfoSchemaReader + +MANIFEST_SCHEMA = "https://schemas.getdbt.com/dbt/manifest/v12.json" +CATALOG_SCHEMA = "https://schemas.getdbt.com/dbt/catalog/v1.json" +RUN_RESULTS_SCHEMA = "https://schemas.getdbt.com/dbt/run-results/v6.json" + +_NODE_TABLES = ( + ("dbt.models", "model"), + ("dbt.seeds", "seed"), + ("dbt.snapshots", "snapshot"), + ("dbt.analyses", "analysis"), + ("dbt.data_tests", "test"), +) +_DEPENDENT_SECTIONS = ( + "nodes", + "sources", + "unit_tests", + "metrics", + "semantic_models", + "saved_queries", + "exposures", +) +_ALL_SECTIONS = _DEPENDENT_SECTIONS + ("macros", "docs", "groups") +_COLUMN_DEFAULTS = {"description": "", "meta": {}, "tags": [], "constraints": []} +_READ_ONLY_EVOLUTIONS = frozenset({"scan"}) + + +def _now() -> str: + return datetime.now(timezone.utc).isoformat() + + +def _empty(value: Any) -> bool: + return value is None or (isinstance(value, (str, list, dict)) and not value) + + +def _compact(record: dict) -> dict: + return {k: v for k, v in record.items() if not _empty(v)} + + +def _fill(base: Any, extra: Any) -> Any: + """``base`` where it has a value, else ``extra``; dicts merge key by key.""" + if _empty(base): + return extra + if isinstance(base, dict) and isinstance(extra, dict): + merged = dict(base) + for key, value in extra.items(): + merged[key] = _fill(base.get(key), value) + return merged + return base + + +def _path(original_file_path: "str | None") -> "str | None": + return original_file_path.split("/", 1)[-1] if original_file_path else None + + +def _common(row: dict, kind: str) -> dict: + properties = row.get("properties_yml_file_path") + package = row.get("package_name") or row["unique_id"].split(".")[1] + return { + "unique_id": row["unique_id"], + "name": row.get("name"), + "resource_type": row.get("resource_type") or kind, + "package_name": package, + "original_file_path": row.get("original_file_path"), + "path": _path(row.get("original_file_path")), + "fqn": row.get("fqn"), + "description": row.get("description"), + "tags": row.get("tags"), + "meta": decode_json_column(row.get("meta")), + "patch_path": f"{package}://{properties}" if properties else None, + } + + +def _config(row: dict) -> dict: + config = decode_json_column(row.get("config")) + config = dict(config) if isinstance(config, dict) else {} + config["materialized"] = row.get("materialized") + return _compact(config) + + +def _physical(row: dict, kind: str) -> dict: + compiled_code = row.get("compiled_code") + record = _common(row, kind) + record.update( + database=row.get("database_name"), + schema=row.get("schema_name"), + alias=row.get("alias") or row.get("name"), + relation_name=row.get("relation_name"), + raw_code=row.get("raw_code"), + compiled_code=compiled_code, + compiled=True if compiled_code else None, + compiled_path=row.get("compiled_path"), + language=row.get("node_language"), + config=_config(row), + access=row.get("access"), + group=row.get("group"), + contract={"enforced": bool(row.get("contract_enforced"))}, + version=decode_json_column(row.get("version")), + latest_version=decode_json_column(row.get("latest_version")), + docs={"show": row["docs_show"]} if row.get("docs_show") is not None else None, + ) + if kind == "test": + record.update( + test_metadata=_compact( + { + "name": row.get("test_name"), + "namespace": row.get("test_definition_package"), + "kwargs": decode_json_column(row.get("arguments")), + } + ), + column_name=row.get("column_name"), + attached_node=row.get("node_unique_id"), + ) + return record + + +def _source(row: dict, kind: str) -> dict: + record = _physical(row, kind) + record.update( + source_name=row.get("source_name"), + source_description=row.get("source_description"), + loader=row.get("loader"), + identifier=row.get("identifier"), + loaded_at_field=row.get("loaded_at_field"), + freshness=decode_json_column(row.get("freshness")), + ) + return record + + +def _unit_test(row: dict, kind: str) -> dict: + record = _common(row, kind) + record.update( + model=row.get("model"), + given=decode_json_column(row.get("given")), + expect=decode_json_column(row.get("expect")), + overrides=decode_json_column(row.get("overrides")), + config=decode_json_column(row.get("config")), + ) + return record + + +def _metric(row: dict, kind: str) -> dict: + record = _common(row, kind) + record.update( + label=row.get("label"), + type=row.get("metric_type"), + type_params=decode_json_column(row.get("type_params")), + filter=decode_json_column(row.get("metric_filter")), + time_granularity=row.get("time_granularity"), + group=row.get("group"), + config=decode_json_column(row.get("config")), + created_at=row.get("created_at"), + ) + return record + + +def _semantic_model(row: dict, kind: str) -> dict: + record = _common(row, kind) + record.update( + label=row.get("label"), + model=row.get("model"), + node_relation=decode_json_column(row.get("node_relation")), + primary_entity=row.get("primary_entity"), + defaults=decode_json_column(row.get("defaults")), + group=row.get("group"), + config=decode_json_column(row.get("config")), + created_at=row.get("created_at"), + ) + return record + + +def _saved_query(row: dict, kind: str) -> dict: + record = _common(row, kind) + record.update( + label=row.get("label"), + query_params=decode_json_column(row.get("query_params")), + exports=decode_json_column(row.get("exports")), + group=row.get("group"), + config=decode_json_column(row.get("config")), + created_at=row.get("created_at"), + ) + return record + + +def _exposure(row: dict, kind: str) -> dict: + record = _common(row, kind) + record.update( + label=row.get("label"), + type=row.get("exposure_type"), + url=row.get("url"), + maturity=row.get("maturity"), + owner=_compact({"name": row.get("owner_name"), "email": row.get("owner_email")}), + config=decode_json_column(row.get("config")), + created_at=row.get("created_at"), + ) + return record + + +def _group(row: dict, kind: str) -> dict: + record = _common(row, kind) + record["owner"] = _compact({"name": row.get("owner_name"), "email": row.get("owner_email")}) + return record + + +def _macro(row: dict, kind: str) -> dict: + record = _common(row, kind) + arguments = decode_json_column(row.get("arguments")) + record.update( + macro_sql=row.get("macro_sql"), + depends_on={"macros": row.get("depends_on_macros")}, + arguments=arguments if isinstance(arguments, list) else None, + ) + return record + + +def _doc(row: dict, kind: str) -> dict: + record = _common(row, kind) + record["block_contents"] = row.get("content") + return record + + +_COLLECTIONS = ( + ("dbt.sources", "sources", "source", _source), + ("dbt.unit_tests", "unit_tests", "unit_test", _unit_test), + ("dbt.metrics", "metrics", "metric", _metric), + ("dbt.semantic_models", "semantic_models", "semantic_model", _semantic_model), + ("dbt.saved_queries", "saved_queries", "saved_query", _saved_query), + ("dbt.exposures", "exposures", "exposure", _exposure), + ("dbt.groups", "groups", "group", _group), + ("dbt.macros", "macros", "macro", _macro), + ("dbt.docs_blocks", "docs", "doc", _doc), +) + +_DEFAULTS = { + "nodes": { + "description": "", + "tags": [], + "meta": {}, + "columns": {}, + "config": {}, + "checksum": {"name": "none", "checksum": ""}, + }, + "sources": { + "description": "", + "tags": [], + "meta": {}, + "columns": {}, + "source_description": "", + "loader": "", + }, + "unit_tests": {"description": "", "tags": [], "meta": {}, "checksum": ""}, + "metrics": {"description": "", "label": "", "type_params": {}}, + "semantic_models": {"description": "", "node_relation": {}}, + "saved_queries": {"description": "", "exports": [], "query_params": {}}, + "exposures": {"description": "", "owner": {}}, + "groups": {"owner": {}}, + "macros": {"description": "", "macro_sql": ""}, + "docs": {"block_contents": ""}, +} + + +def _group_by(rows: "list[dict]", key: str) -> "dict[str, list[dict]]": + grouped: dict[str, list[dict]] = defaultdict(list) + for row in rows: + grouped[row[key]].append(row) + return grouped + + +def _columns(reader: InfoSchemaReader) -> "dict[str, dict]": + columns: dict[str, dict] = defaultdict(dict) + for row in sorted(reader.table("dbt.node_columns"), key=lambda r: r.get("column_index") or 0): + columns[row["node_unique_id"]][row["column_name"]] = _compact( + { + "name": row["column_name"], + "description": row.get("description"), + "data_type": row.get("data_type_declared"), + "tags": row.get("tags"), + "meta": decode_json_column(row.get("meta")), + "granularity": row.get("granularity"), + } + ) + return columns + + +def _semantic_parts(reader: InfoSchemaReader) -> "dict[str, dict]": + parts: dict[str, dict] = defaultdict(lambda: {"entities": [], "measures": [], "dimensions": []}) + for row in reader.table("dbt.semantic_entities"): + parts[row["unique_id"]]["entities"].append( + { + "name": row["name"], + "type": row.get("entity_type"), + "description": row.get("description"), + "label": row.get("label"), + "role": row.get("entity_role"), + "expr": row.get("expr"), + } + ) + for row in reader.table("dbt.semantic_measures"): + parts[row["unique_id"]]["measures"].append( + { + "name": row["name"], + "agg": row.get("agg"), + "description": row.get("description"), + "label": row.get("label"), + "expr": row.get("expr"), + "create_metric": row.get("create_metric"), + "agg_time_dimension": row.get("agg_time_dimension"), + "agg_params": decode_json_column(row.get("agg_params")), + "non_additive_dimension": decode_json_column(row.get("non_additive_dimension")), + } + ) + for row in reader.table("dbt.semantic_dimensions"): + granularity = row.get("time_granularity") + parts[row["unique_id"]]["dimensions"].append( + _compact( + { + "name": row["name"], + "type": row.get("dimension_type"), + "description": row.get("description"), + "label": row.get("label"), + "expr": row.get("expr"), + "is_partition": row.get("is_partition"), + "type_params": { + "time_granularity": granularity, + "validity_params": decode_json_column(row.get("validity_params")), + } + if granularity + else None, + } + ) + ) + return parts + + +def _edges(reader: InfoSchemaReader) -> "tuple[dict, dict]": + parents: dict[str, list[str]] = defaultdict(list) + children: dict[str, list[str]] = defaultdict(list) + for row in reader.table("dbt.edges"): + parent, child = row["parent_unique_id"], row["child_unique_id"] + if parent.startswith("macro.") or child.startswith("macro."): + continue + parents[child].append(parent) + children[parent].append(child) + return parents, children + + +def _known_json_records(json_manifest: "dict | None") -> "dict[str, dict]": + known: dict[str, dict] = {} + for section in _ALL_SECTIONS: + known.update((json_manifest or {}).get(section) or {}) + return known + + +def _finish(record: dict, section: str, json_record: "dict | None") -> dict: + merged = _fill(_compact(record), json_record or {}) + for key, value in _DEFAULTS[section].items(): + merged.setdefault(key, value) + merged.setdefault("path", "") + merged.setdefault("original_file_path", "") + if section in _DEPENDENT_SECTIONS: + merged.setdefault("fqn", [merged.get("package_name"), merged.get("name")]) + if section == "unit_tests" and isinstance(merged["checksum"], dict): + merged["checksum"] = merged["checksum"].get("checksum") or "" + for column in (merged.get("columns") or {}).values(): + for key, value in _COLUMN_DEFAULTS.items(): + column.setdefault(key, value) + return merged + + +def build_manifest(reader: InfoSchemaReader, json_manifest: "dict | None" = None) -> dict: + known = _known_json_records(json_manifest) + parents, children = _edges(reader) + columns = _columns(reader) + semantic_parts = _semantic_parts(reader) + manifest: dict = {section: {} for section in _ALL_SECTIONS} + + jobs = [ + (section, kind, builder, row) + for table, section, kind, builder in _COLLECTIONS + for row in reader.table(table) + ] + jobs += [ + ("nodes", kind, _physical, row) + for table, kind in _NODE_TABLES + for row in reader.table(table) + ] + for section, kind, builder, row in jobs: + record = builder(row, kind) + unique_id = record["unique_id"] + if section in _DEPENDENT_SECTIONS: + record["depends_on"] = {"nodes": parents.get(unique_id)} + if unique_id in columns: + record["columns"] = columns[unique_id] + record.update(semantic_parts.get(unique_id, {}) if section == "semantic_models" else {}) + manifest[section][unique_id] = _finish(record, section, known.get(unique_id)) + + project = (reader.table("dbt.project") or [{}])[0] + metadata = _fill( + _compact( + { + "dbt_version": project.get("dbt_version"), + "project_name": project.get("project_name"), + "adapter_type": project.get("adapter_type"), + "quoting": decode_json_column(project.get("quoting")), + } + ), + (json_manifest or {}).get("metadata") or {}, + ) + metadata["dbt_schema_version"] = MANIFEST_SCHEMA + metadata.setdefault("generated_at", _now()) + manifest["metadata"] = metadata + + ids = [uid for section in _DEPENDENT_SECTIONS for uid in manifest[section]] + manifest["parent_map"] = _fill( + {uid: parents.get(uid, []) for uid in ids}, (json_manifest or {}).get("parent_map") + ) + manifest["child_map"] = _fill( + {uid: children.get(uid, []) for uid in ids}, (json_manifest or {}).get("child_map") + ) + group_map: dict[str, list[str]] = defaultdict(list) + for uid, node in manifest["nodes"].items(): + if node.get("group"): + group_map[node["group"]].append(uid) + manifest["group_map"] = dict(group_map) + manifest["selectors"] = (json_manifest or {}).get("selectors") or {} + manifest["disabled"] = (json_manifest or {}).get("disabled") or {} + return manifest + + +def _catalog_type(json_column: "dict | None", row: dict) -> "str | None": + return ( + (json_column or {}).get("type") + or row.get("data_type_actual") + or row.get("data_type_declared") + or row.get("data_type_inferred") + ) + + +def build_catalog(reader: InfoSchemaReader, json_catalog: "dict | None" = None) -> dict: + json_catalog = json_catalog or {} + json_records = {**(json_catalog.get("sources") or {}), **(json_catalog.get("nodes") or {})} + manifest_rows = { + row["unique_id"]: row + for table in ("dbt.models", "dbt.seeds", "dbt.snapshots", "dbt.sources") + for row in reader.table(table) + } + by_node = _group_by(reader.table("dbt.node_columns"), "node_unique_id") + catalog: dict = {"nodes": {}, "sources": {}} + for unique_id, rows in by_node.items(): + owner = manifest_rows.get(unique_id) + if owner is None: + continue + json_record = json_records.get(unique_id) or {} + json_columns = {str(k).lower(): v for k, v in (json_record.get("columns") or {}).items()} + columns = {} + for index, row in enumerate(sorted(rows, key=lambda r: r.get("column_index") or 0)): + name = row["column_name"] + columns[name] = _compact( + { + "name": name, + "index": index, + "type": _catalog_type(json_columns.get(name.lower()), row), + "comment": None, + } + ) + columns[name].setdefault("type", "") + record = { + "unique_id": unique_id, + "metadata": { + "type": owner.get("materialized") or "table", + "schema": owner.get("schema_name"), + "name": owner.get("identifier") or owner.get("name"), + "database": owner.get("database_name"), + }, + "columns": columns, + "stats": {}, + } + section = "sources" if unique_id.startswith("source.") else "nodes" + catalog[section][unique_id] = _fill(record, json_record) + for section in ("nodes", "sources"): + for unique_id, json_record in (json_catalog.get(section) or {}).items(): + catalog[section].setdefault(unique_id, json_record) + project = (reader.table("dbt.project") or [{}])[0] + catalog.update( + metadata={ + "dbt_schema_version": CATALOG_SCHEMA, + "dbt_version": project.get("dbt_version") or "", + "generated_at": _now(), + "env": {}, + }, + errors=None, + ) + return catalog + + +def _run_result(row: dict, json_result: "dict | None") -> dict: + result = _fill( + _compact( + { + "unique_id": row["unique_id"], + "status": row.get("status"), + "timing": decode_json_column(row.get("timing")), + "thread_id": row.get("thread_id"), + "execution_time": row.get("execution_time"), + "adapter_response": decode_json_column(row.get("adapter_response")), + "message": row.get("message"), + "failures": row.get("failures"), + "compiled": row.get("compiled"), + "relation_name": row.get("relation_name"), + } + ), + json_result or {}, + ) + defaults = { + "timing": [], + "thread_id": "", + "execution_time": 0.0, + "adapter_response": {}, + "message": "", + "failures": None, + "compiled": False, + "compiled_code": None, + "relation_name": None, + } + for key, value in defaults.items(): + result.setdefault(key, value) + return result + + +def _latest_invocation(reader: InfoSchemaReader, rows: "list[dict]") -> "dict | None": + with_tests = { + r["invocation_id"] for r in rows if r["unique_id"].split(".")[0] in ("test", "unit_test") + } + candidates = [i for i in reader.table("dbt_rt.invocations") if i["invocation_id"] in with_tests] + if not candidates: + return None + return max( + candidates, key=lambda i: i.get("generated_at") or datetime.min.replace(tzinfo=timezone.utc) + ) + + +def build_run_results( + reader: InfoSchemaReader, json_run_results: "dict | None" = None +) -> "dict | None": + rows = reader.table("dbt_rt.run_results") + invocation = _latest_invocation(reader, rows) + if invocation is None: + return json_run_results + json_by_id = {r.get("unique_id"): r for r in (json_run_results or {}).get("results") or []} + results = [ + _run_result(row, json_by_id.get(row["unique_id"])) + for row in rows + if row["invocation_id"] == invocation["invocation_id"] + ] + return { + "metadata": { + "dbt_schema_version": RUN_RESULTS_SCHEMA, + "dbt_version": invocation.get("dbt_version") or "", + "generated_at": invocation["generated_at"].isoformat() + if invocation.get("generated_at") + else _now(), + "invocation_id": invocation["invocation_id"], + "env": {}, + }, + "results": results, + "elapsed_time": invocation.get("elapsed_time") or 0.0, + "args": {}, + } + + +def column_lineage(reader: InfoSchemaReader) -> dict: + """``dbt.column_lineage`` value lineage as ``{".": [{node, column}, ...]}``. + + Rows whose ``evolution`` is in ``_READ_ONLY_EVOLUTIONS`` (``scan``: a join, filter + or grouping key that is read but does not feed the column's value) are dropped, + so the result means what the sqlglot lineage means. Refs are deduplicated and + sorted by ``(node, column)``. + """ + refs: dict[str, set] = defaultdict(set) + for row in reader.table("dbt.column_lineage"): + if row.get("evolution") in _READ_ONLY_EVOLUTIONS: + continue + key = f"{row['child_node_unique_id']}.{row['child_column_name']}" + refs[key].add((row["parent_node_unique_id"], row["parent_column_name"])) + return { + key: [{"node": node, "column": column} for node, column in sorted(pairs)] + for key, pairs in refs.items() + } diff --git a/docs/assets/img/dbt-2-info-schema.gif b/docs/assets/img/dbt-2-info-schema.gif new file mode 100644 index 0000000..3af2965 Binary files /dev/null and b/docs/assets/img/dbt-2-info-schema.gif differ diff --git a/docs/nav/guide/cli-references.md b/docs/nav/guide/cli-references.md index 06389b6..481e0b8 100644 --- a/docs/nav/guide/cli-references.md +++ b/docs/nav/guide/cli-references.md @@ -25,6 +25,7 @@ Build the site from your dbt artifacts. dbdocs generate dbdocs generate -o public --dialect snowflake dbdocs generate --run-results target/run_results.json +dbdocs generate --info-schema ``` | Option | Description | @@ -32,6 +33,20 @@ dbdocs generate --run-results target/run_results.json | `-o, --output-dir` | Where to write the site (overrides config). | | `--dialect` | SQL dialect for column lineage (overrides `adapter_type`). | | `--run-results` | Path to `run_results.json` for the Health Check (default `/run_results.json`). Absent or unparseable, the Health Check is silently skipped. | +| `--info-schema / --no-info-schema` | Read dbt 2.0's parquet information schema as the base, with any JSON artifacts as enrichment (default off). Needs `pip install "dbdocs[info-schema]"` and a dbt run with `--generate-info-schema`. | +| `--info-schema-dir` | The info-schema directory (default `/info_schema/v1`). | + +To make it the default rather than a per-run flag, set `info_schema: true` in +`dbdocs.yml` — see [dbt 2.0 & Info Schema](./dbt-2-info-schema.md) for the full +walkthrough. With `--info-schema`, the parquet decides which resources exist and its values +win; `manifest.json` / `catalog.json` / `run_results.json`, when present, only +fill gaps. Column types prefer the warehouse type from `catalog.json`, then the +info schema's actual, declared, and inferred types. When the info schema carries +column lineage (dbt Fusion with `--static-analysis strict`), it replaces the +SQL-parsed lineage. Only the columns that feed a value count as upstream; join, +filter and grouping keys dbt marks as merely read are left out, just as the +SQL-parsed lineage leaves them out. The default JSON pipeline is untouched when +the flag is off. Outputs the SPA shell `index.html`, the external `dbdocs-data.json.gz` payload it fetches (plus a plain `dbdocs-data.json` debug dump), and a static @@ -71,6 +86,8 @@ dbdocs deploy --version 1.2 --alias latest --push | `--title` | the version| Display title for this version. | | `--delete` | off | Delete this version instead of deploying it. | | `--push / --no-push` | `--no-push`| Publish to the `gh-pages` branch (opt-in). | +| `--info-schema / --no-info-schema` | off | Build from the dbt 2.0 info schema (see `generate`). | +| `--info-schema-dir` | `/info_schema/v1` | The info-schema directory. | `--version` and `--alias` must match `[A-Za-z0-9._-]+` and cannot be `.` or `..` — no spaces, slashes, or path separators. Invalid values raise a diff --git a/docs/nav/guide/configuration.md b/docs/nav/guide/configuration.md index 0ee616a..bd93301 100644 --- a/docs/nav/guide/configuration.md +++ b/docs/nav/guide/configuration.md @@ -37,6 +37,8 @@ These keys control the generate/deploy pipeline rather than display. | `output_dir` | `target/site` | Where the generated site is written. | | `dialect` | adapter type | SQL dialect override for column-level lineage parsing. Omit to derive from the artifact's `adapter_type` (snowflake, bigquery, postgres, …). | | `default_version` | `latest` | Alias the version switcher lands on. | +| `info_schema` | `false` | Read dbt 2.0's parquet information schema as the base, with any JSON artifacts in `target_dir` as enrichment. Same as `--info-schema`; needs `pip install "dbdocs[info-schema]"`. Walkthrough: [dbt 2.0 & Info Schema](./dbt-2-info-schema.md). | +| `info_schema_dir` | `/info_schema/v1` | Where the parquet files live. Same as `--info-schema-dir`. | !!! warning "Relative paths cannot escape the project directory" Relative `target_dir` and `output_dir` values that use `..` to climb above diff --git a/docs/nav/guide/dbt-2-info-schema.md b/docs/nav/guide/dbt-2-info-schema.md new file mode 100644 index 0000000..7649ea7 --- /dev/null +++ b/docs/nav/guide/dbt-2-info-schema.md @@ -0,0 +1,134 @@ +# dbt 2.0 & Info Schema + +dbt 2.0 changes what lands in `target/`. `dbt docs generate` no longer writes +`catalog.json`, and dbt can now write a **parquet information schema** to +`target/info_schema/v1/` — a typed, versioned snapshot of your project that +carries everything the JSON artifacts did, and on dbt Fusion quite a bit more. + +dbdocs works with dbt 2.0 either way. This page explains the two paths and walks +you through switching dbdocs onto the information schema. + +![dbt Fusion writes the info schema with strict static analysis; dbdocs, with info_schema: true, builds and serves the site from it](../../assets/img/dbt-2-info-schema.gif) + +## Two ways to read a dbt 2.0 project + +| | Default (JSON artifacts) | Info schema (opt-in) | +|---|---|---| +| Reads | `manifest.json` (+ `catalog.json` if present) | `target/info_schema/v1/*.parquet`, with any JSON artifacts as enrichment | +| Column types | Only what your YAML declares (no catalog on dbt 2.0) | Inferred by dbt for every column it can see | +| Column-level lineage | Parsed from compiled SQL by dbdocs | Computed by dbt itself (dbt Fusion with strict static analysis) | +| Extra install | none | `pip install "dbdocs[info-schema]"` (adds DuckDB) | +| Turned on by | nothing — it's the default | `info_schema: true` in `dbdocs.yml` | + +You don't have to switch. With no catalog, the default path builds from the +manifest alone and simply knows less about your columns. Switch when you want +the fuller picture. + +## 1. Install the extra + +```bash +pip install "dbdocs[info-schema]" +``` + +The info-schema reader uses DuckDB to read parquet. Without the extra, enabling +the option stops with `info_schema needs DuckDB: install it with +pip install 'dbdocs[info-schema]'` rather than failing somewhere obscure. + +## 2. Have dbt write the info schema + +Add `--generate-info-schema` to the dbt command you already run: + +=== "dbt Fusion (recommended)" + + ```bash + dbt build --generate-info-schema --static-analysis strict + ``` + + Strict static analysis is what makes dbt Fusion compute column types and + **column-level lineage** for every model and store them in the info schema. + +=== "dbt Core 2.0" + + ```bash + dbt build --generate-info-schema + ``` + + dbt Core 2.0 writes the same tables, but leaves column lineage empty and + infers types for fewer columns — dbdocs then falls back to its own + SQL-parsed lineage, so you still get lineage, just not dbt's. + +Either way you end up with `target/info_schema/v1/` full of `dbt.*.parquet` +files. `dbt compile` works too if you don't need test results on the Health page. + +## 3. Turn it on in `dbdocs.yml` + +```yaml +# dbdocs.yml +target_dir: target +info_schema: true +# info_schema_dir: target/info_schema/v1 # only if dbt writes it elsewhere +``` + +That's the whole switch: every `dbdocs generate` and `dbdocs deploy` now reads the +info schema. `info_schema_dir` defaults to `/info_schema/v1`; a +relative path that climbs out of the project with `..` is rejected, same as +`target_dir`. + +!!! tip "Trying it once, or turning it off for one run" + The CLI flags override the config for a single run, so you can try the info + schema before committing to it, or skip it once without editing the file: + + ```bash + dbdocs generate --info-schema # on for this run + dbdocs generate --no-info-schema # off for this run + dbdocs generate --info-schema-dir path/to/v1 # a different directory + ``` + + `dbdocs deploy` takes the same three flags. See the + [CLI Reference](./cli-references.md#dbdocs-generate). + +## 4. Generate as usual + +```bash +dbdocs generate +dbdocs serve +``` + +Nothing else changes: same site, same ERD, same REST API. The site's metadata +records `artifact_source: info_schema`, so you can tell which path built it. + +## How the two sources combine + +The info schema is the **base**; any `manifest.json`, `catalog.json` or +`run_results.json` left in `target_dir` only **fills gaps**: + +- The parquet decides which models, sources, tests and semantic objects exist, + and its values win. A JSON record only supplies fields the parquet left empty. +- **Column types** take the most trustworthy source available: the warehouse + type from `catalog.json`, then the type dbt measured, then the one declared in + your YAML, then the one dbt inferred. +- **Column-level lineage** comes from dbt when it computed some. dbdocs keeps + only the columns that actually feed a value — join, filter and grouping keys + that dbt records as merely *read* are left out, exactly as the SQL-parsed + lineage leaves them out. When dbt computed none, the SQL-parsed lineage stays. +- **Health** uses the latest dbt run in the info schema that ran tests, so a + later `dbt docs generate` can't wipe your test results the way it overwrites + `run_results.json`. + +So it's safe to keep the JSON artifacts around — they can only add detail, never +override what dbt wrote to the info schema. + +## Troubleshooting + +| You see | Means | Fix | +|---|---|---| +| `info_schema directory not found: …` | No parquet where dbdocs looked | Re-run dbt with `--generate-info-schema`, or point `info_schema_dir` at the right folder | +| `Unsupported info_schema schema_version …` | dbt wrote a newer info-schema layout than this dbdocs knows | Upgrade dbdocs | +| `info_schema needs DuckDB …` | The extra isn't installed | `pip install "dbdocs[info-schema]"` | +| `Ignoring … as info_schema enrichment: …` (warning) | A JSON artifact in `target_dir` is unreadable or corrupt | Harmless — it's skipped. Delete it or re-run dbt to quiet the warning | +| Health page missing | No dbt run that executed tests is recorded | Run `dbt build` or `dbt test` with `--generate-info-schema` | +| Thin column lineage | dbt computed none (dbt Core, or Fusion without strict analysis) | Use dbt Fusion with `--static-analysis strict` | + +An explicit opt-in never falls back to the JSON path silently: if the info +schema is missing or unreadable, dbdocs stops and tells you, rather than quietly +building a different site than the one you asked for. diff --git a/docs/nav/guide/quickstart.md b/docs/nav/guide/quickstart.md index c1803d8..d09b7db 100644 --- a/docs/nav/guide/quickstart.md +++ b/docs/nav/guide/quickstart.md @@ -15,20 +15,40 @@ dbt docs generate # writes target/manifest.json + target/catalog.json !!! tip "Why both files?" `manifest.json` carries the graph (models, sources, tests, refs, compiled SQL); `catalog.json` carries the column types pulled from your warehouse. - dbdocs needs both — the catalog is what makes `SELECT *` resolve in + The manifest is required; the catalog is optional but worth having — it's + what gives columns their warehouse types and makes `SELECT *` resolve in column-level lineage. +!!! note "On dbt 2.0?" + dbt 2.0's `docs generate` no longer writes `catalog.json`. dbdocs still + builds from `manifest.json` alone, just without warehouse column types and + with thinner column-level lineage. For the full picture, have dbt write its + parquet information schema and switch dbdocs onto it in `dbdocs.yml`: + + ```bash + pip install "dbdocs[info-schema]" + dbt build --generate-info-schema # writes target/info_schema/v1/ + echo "info_schema: true" >> dbdocs.yml + ``` + + [dbt 2.0 & Info Schema](./dbt-2-info-schema.md) walks through it: dbt Fusion + vs dbt Core, how the parquet and JSON artifacts combine, and what to do when + something looks off. + ## 2. Generate the site ```bash -dbdocs generate # builds ./site/index.html with all data baked in +dbdocs generate # builds the site into target/site/ ``` This reads the artifacts (from `target/` by default), derives the documentation data — catalog nodes, the lineage graph, the ERD, and column-level lineage — and -writes a single self-contained `site/index.html` plus a `site/dbdocs-data.json` -companion. Everything the SPA needs is base64-injected into that one HTML file, -so it works straight off the filesystem. +writes the site to `target/site/` (change it with `output_dir`): a small +`index.html`, the data as a gzipped `dbdocs-data.json.gz` the page fetches on +load (plus a plain `dbdocs-data.json` for poking at), and a static +[REST API](./rest-api.md) under `api/v1/`. Because the page fetches its data, +the site has to be served over HTTP — double-clicking `index.html` opens a page +with nothing to show. [How It Works](./how-it-works.md) explains why. ## 3. Serve it diff --git a/docs/scripts/record-gif/browse.mjs b/docs/scripts/record-gif/browse.mjs new file mode 100644 index 0000000..21978d8 --- /dev/null +++ b/docs/scripts/record-gif/browse.mjs @@ -0,0 +1,56 @@ +// Browser half of docs/assets/img/dbt-2-info-schema.gif — run via record.sh. +// Usage: node browse.mjs +import { createRequire } from "node:module"; + +const require = createRequire(new URL("../../../frontend/package.json", import.meta.url)); +const { chromium } = require("@playwright/test"); + +const [baseUrl, videoDir] = process.argv.slice(2); +const size = { width: 1280, height: 720 }; + +const browser = await chromium.launch(); +const context = await browser.newContext({ + viewport: size, + colorScheme: "dark", + recordVideo: { dir: videoDir, size }, +}); +await context.addInitScript(() => localStorage.setItem("dbdocs-theme", "dark")); +const page = await context.newPage(); +const pause = (ms) => page.waitForTimeout(ms); + +async function visit(hash, ms) { + await page.goto(`${baseUrl}/${hash}`); + await page.waitForLoadState("networkidle"); + await pause(ms); +} + +async function scroll(steps, delta) { + await page.mouse.move(820, 420); + for (let i = 0; i < steps; i += 1) { + await page.mouse.wheel(0, delta); + await pause(450); + } +} + +async function showErd(hash) { + await visit(hash, 900); + await page.locator(".content").evaluate((content) => { + const heading = document.getElementById("erd-heading"); + const offset = heading.getBoundingClientRect().top - content.getBoundingClientRect().top; + content.scrollTo({ top: content.scrollTop + offset - 16, behavior: "smooth" }); + }); + await pause(3400); +} + +await visit("#/overview", 2500); +await showErd("#/erd"); +await showErd("#/erd?erd_focus=model.jaffle_shop.orders"); +await visit("#/node/model.jaffle_shop.orders", 2000); +await scroll(3, 260); +await pause(1200); +await visit("#/node/model.jaffle_shop.orders?col=order_total", 3200); +await visit("#/dag?focus=model.jaffle_shop.order_items", 3500); +await visit("#/health", 2500); + +await context.close(); +await browser.close(); diff --git a/docs/scripts/record-gif/info-schema.tape b/docs/scripts/record-gif/info-schema.tape new file mode 100644 index 0000000..5bbdd3a --- /dev/null +++ b/docs/scripts/record-gif/info-schema.tape @@ -0,0 +1,46 @@ +# Terminal half of docs/assets/img/dbt-2-info-schema.gif — run via record.sh, +# which exports DEMO (the jaffle-shop dbt project), REPO and DBT_DIR (dbt Fusion), +# and cds into a work dir. +Output terminal.mp4 + +Set Shell "bash" +Set FontSize 16 +Set Width 1280 +Set Height 720 +Set Padding 24 +Set Theme "Catppuccin Mocha" +Set WindowBar Colorful +Set TypingSpeed 40ms + +Hide +Type 'cd "$DEMO" && export PATH="$DBT_DIR:$PATH" DBT_PROFILES_DIR="$DEMO" DBT_LOG_FORMAT=text && dbdocs() { "$REPO/.venv/bin/dbdocs" "$@"; } && export PS1="\[\e[1;36m\]jaffle_shop\[\e[0m\] $ " && clear' +Enter +Show + +Sleep 600ms +Type "dbt build --generate-info-schema --static-analysis strict" +Enter +Wait+Line@90s /jaffle_shop \$/ +Sleep 3s + +Type "clear" +Enter +Type "ls target/info_schema/v1 | head -5" +Enter +Sleep 2s + +Type "cat dbdocs.yml" +Enter +Sleep 2.5s + +Type "dbdocs generate" +Enter +Wait+Screen@30s /Generated site/ +Sleep 3s + +Type "dbdocs serve" +Enter +Wait+Screen@15s /Serving/ +Sleep 3s +Ctrl+C +Sleep 600ms diff --git a/docs/scripts/record-gif/record.sh b/docs/scripts/record-gif/record.sh new file mode 100755 index 0000000..b3bd364 --- /dev/null +++ b/docs/scripts/record-gif/record.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# Record docs/assets/img/dbt-2-info-schema.gif: the terminal (dbt Fusion writes the +# info schema, then `dbdocs generate` / `dbdocs serve` with `info_schema: true`) +# followed by a browser walkthrough of the served site. +# +# Needs: dbt Fusion on PATH (or DBT=/path/to/dbt), vhs (brew install vhs — brings +# ttyd + ffmpeg), the uv env (`task install`) and the Playwright browser +# (`task frontend:install frontend:e2e:install`). +# +# DEMO_DIR shows up in the GIF (dbt and dbdocs print absolute paths), so keep it +# free of anything personal — the default is a shared, user-agnostic location. +set -euo pipefail + +REPO=$(cd "$(dirname "$0")/../../.." && pwd) +DEMO=${DEMO_DIR:-/Users/Shared/jaffle_shop} +OUT=${OUT:-$REPO/docs/assets/img/dbt-2-info-schema.gif} +DBT=${DBT:-$(command -v dbt)} +JAFFLE_SHOP_REF=5beb145 +PORT=8000 +WORK=$(mktemp -d) +DBT_DIR=$(dirname "$DBT") +export REPO DEMO DBT_DIR + +if [ ! -d "$DEMO/.git" ]; then + rm -rf "$DEMO" + git clone -q https://github.com/dbt-labs/jaffle-shop.git "$DEMO" +fi +git -C "$DEMO" checkout -q --force "$JAFFLE_SHOP_REF" + +perl -pi -e "s/^profile: .*/profile: default/; s/var\('load_source_data', false\)/var('load_source_data', true)/" \ + "$DEMO/dbt_project.yml" +perl -pi -e "s/as date\)\"/as timestamp)\"/g" "$DEMO/models/marts/metricflow_time_spine.sql" +cat > "$DEMO/profiles.yml" <<'YAML' +default: + target: dev + outputs: + dev: + type: duckdb + path: jaffle_shop.duckdb + threads: 4 +YAML +cat > "$DEMO/dbdocs.yml" <<'YAML' +site_name: Jaffle Shop +target_dir: target +output_dir: site +info_schema: true +YAML +(cd "$DEMO" && DBT_PROFILES_DIR="$DEMO" "$DBT" deps >/dev/null) + +(cd "$WORK" && vhs "$REPO/docs/scripts/record-gif/info-schema.tape") + +(cd "$DEMO" && exec "$REPO/.venv/bin/dbdocs" serve -p "$PORT") >/dev/null 2>&1 & +SERVER=$! +trap 'kill "$SERVER" 2>/dev/null || true' EXIT +until curl -sf "http://127.0.0.1:$PORT/" >/dev/null; do sleep 0.3; done + +node "$REPO/docs/scripts/record-gif/browse.mjs" "http://127.0.0.1:$PORT" "$WORK/video" +BROWSER_VIDEO=$(ls -t "$WORK"/video/*.webm | head -1) + +ffmpeg -loglevel error -y -i "$WORK/terminal.mp4" -i "$BROWSER_VIDEO" -filter_complex \ + "[0:v]fps=6,scale=880:-2:flags=lanczos,setsar=1[t];\ +[1:v]fps=6,scale=880:-2:flags=lanczos,setsar=1[b];\ +[t][b]concat=n=2:v=1:a=0,split[x][y];\ +[x]palettegen=max_colors=64:stats_mode=diff[p];\ +[y][p]paletteuse=dither=none:diff_mode=rectangle" \ + "$OUT" + +echo "Wrote $OUT ($(du -h "$OUT" | cut -f1))" diff --git a/mkdocs.yml b/mkdocs.yml index ba3ad70..158ec31 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -11,6 +11,7 @@ copyright: Copyright © 2024-2026 Dat Nguyen exclude_docs: | dbdocs-demo.yml + scripts/ nav: - dbdocs: @@ -20,6 +21,7 @@ nav: - Quickstart: nav/guide/quickstart.md - How It Works: nav/guide/how-it-works.md - Configuration: nav/guide/configuration.md + - dbt 2.0 & Info Schema: nav/guide/dbt-2-info-schema.md - Full-text Search: nav/guide/search.md - Versioned Deploy: nav/guide/versioned-deploy.md - REST API: nav/guide/rest-api.md diff --git a/pyproject.toml b/pyproject.toml index d43e467..db4bd7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,14 +15,17 @@ classifiers = [ "Topic :: Software Development :: Quality Assurance", ] dependencies = [ - "artifact-parser[dbt]>=1.0.0", + "artifact-parser[dbt]>=1.1.0", "click>=8.1", - "dbterd>=1.28", + "dbterd>=1.35.1", "pydantic>=2.13.4", "pyyaml>=6.0", "sqlglot>=25", ] +[project.optional-dependencies] +info-schema = ["duckdb>=1.1"] + [project.urls] Homepage = "https://github.com/datnguye/dbt-docs" Repository = "https://github.com/datnguye/dbt-docs" @@ -58,6 +61,7 @@ dev = [ "dbt-postgres>=1.5", "pdoc>=14.4.0", "jsonschema>=4.20", + "duckdb>=1.1", ] docs = [ "mkdocs>=1.6,<2.0", diff --git a/tests/conftest.py b/tests/conftest.py index ba57a96..19a8b85 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -371,3 +371,39 @@ def fake_catalog(): ) }, ) + + +JAFFLE_V2_ARTIFACTS = FIXTURES_DIR / "jaffle_shop_v2" + + +@pytest.fixture +def v2_target(tmp_path): + """A copy of the dbt 2.0 fixture: parquet info schema plus its JSON artifacts.""" + target = tmp_path / "v2_target" + shutil.copytree(JAFFLE_V2_ARTIFACTS, target) + return target + + +@pytest.fixture +def v2_parquet_only(tmp_path): + """A copy of the dbt 2.0 fixture holding only the parquet info schema.""" + target = tmp_path / "v2_parquet" + shutil.copytree(JAFFLE_V2_ARTIFACTS / "info_schema", target / "info_schema") + return target + + +@pytest.fixture +def info_schema_config(v2_target, tmp_path): + return DbDocsConfig( + target_dir=str(v2_target), output_dir=str(tmp_path / "site"), info_schema=True + ) + + +def _make_reader(tables): + return SimpleNamespace(table=lambda name: tables.get(name, [])) + + +@pytest.fixture +def fake_reader(): + """Factory for a reader stand-in serving the given ``{table: rows}``.""" + return _make_reader diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.analyses.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.analyses.parquet new file mode 100644 index 0000000..80497b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.analyses.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.checks.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.checks.parquet new file mode 100644 index 0000000..80497b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.checks.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.classifiers.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.classifiers.parquet new file mode 100644 index 0000000..38cda37 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.classifiers.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.column_lineage.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.column_lineage.parquet new file mode 100644 index 0000000..9664237 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.column_lineage.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.dag_nodes.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.dag_nodes.parquet new file mode 100644 index 0000000..9354efa Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.dag_nodes.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.data_tests.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.data_tests.parquet new file mode 100644 index 0000000..bb4b1b2 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.data_tests.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.docs_blocks.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.docs_blocks.parquet new file mode 100644 index 0000000..cedfe5f Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.docs_blocks.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.edges.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.edges.parquet new file mode 100644 index 0000000..8018383 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.edges.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.exposures.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.exposures.parquet new file mode 100644 index 0000000..a0ca0bc Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.exposures.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.functions.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.functions.parquet new file mode 100644 index 0000000..80497b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.functions.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.groups.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.groups.parquet new file mode 100644 index 0000000..df3e6fd Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.groups.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.hooks.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.hooks.parquet new file mode 100644 index 0000000..80497b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.hooks.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.macros.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.macros.parquet new file mode 100644 index 0000000..770dbff Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.macros.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.metrics.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.metrics.parquet new file mode 100644 index 0000000..7540627 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.metrics.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.models.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.models.parquet new file mode 100644 index 0000000..411cb01 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.models.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.node_columns.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.node_columns.parquet new file mode 100644 index 0000000..fb419a2 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.node_columns.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.packages.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.packages.parquet new file mode 100644 index 0000000..8800edb Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.packages.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project.parquet new file mode 100644 index 0000000..e254172 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_env_vars.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_env_vars.parquet new file mode 100644 index 0000000..8a1e828 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_env_vars.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_vars.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_vars.parquet new file mode 100644 index 0000000..ee84fa5 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.project_vars.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.saved_queries.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.saved_queries.parquet new file mode 100644 index 0000000..d6ea98a Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.saved_queries.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.seeds.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.seeds.parquet new file mode 100644 index 0000000..a511af4 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.seeds.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_dimensions.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_dimensions.parquet new file mode 100644 index 0000000..2af7e83 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_dimensions.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_entities.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_entities.parquet new file mode 100644 index 0000000..10c2e93 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_entities.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_measures.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_measures.parquet new file mode 100644 index 0000000..9910eb8 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_measures.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_models.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_models.parquet new file mode 100644 index 0000000..d773d71 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_models.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_relationships.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_relationships.parquet new file mode 100644 index 0000000..c13bf42 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.semantic_relationships.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.snapshots.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.snapshots.parquet new file mode 100644 index 0000000..80497b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.snapshots.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.sources.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.sources.parquet new file mode 100644 index 0000000..0a97de2 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.sources.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.time_spines.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.time_spines.parquet new file mode 100644 index 0000000..d88469e Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.time_spines.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.unit_tests.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.unit_tests.parquet new file mode 100644 index 0000000..72950f7 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt.unit_tests.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_internal.node_input_files.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_internal.node_input_files.parquet new file mode 100644 index 0000000..901fd64 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_internal.node_input_files.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.adapter_queries.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.adapter_queries.parquet new file mode 100644 index 0000000..2af0259 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.adapter_queries.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.diagnostics.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.diagnostics.parquet new file mode 100644 index 0000000..79006b6 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.diagnostics.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.freshness.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.freshness.parquet new file mode 100644 index 0000000..b44d24c Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.freshness.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.invocations.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.invocations.parquet new file mode 100644 index 0000000..fdd9f35 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.invocations.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.relations.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.relations.parquet new file mode 100644 index 0000000..cbf3ccf Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.relations.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.run_results.parquet b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.run_results.parquet new file mode 100644 index 0000000..be80717 Binary files /dev/null and b/tests/fixtures/jaffle_shop_v2/info_schema/v1/dbt_rt.run_results.parquet differ diff --git a/tests/fixtures/jaffle_shop_v2/info_schema/v1/views.sql b/tests/fixtures/jaffle_shop_v2/info_schema/v1/views.sql new file mode 100644 index 0000000..71beece --- /dev/null +++ b/tests/fixtures/jaffle_shop_v2/info_schema/v1/views.sql @@ -0,0 +1,69 @@ +-- dbt information schema. Generated; do not edit. +-- +-- Query with: +-- duckdb -cmd ".read views.sql" +-- +-- Objects in dbt_internal are not part of the public contract and may +-- change without notice. + +CREATE SCHEMA IF NOT EXISTS dbt; +CREATE SCHEMA IF NOT EXISTS dbt_rt; +CREATE SCHEMA IF NOT EXISTS dbt_internal; + +CREATE OR REPLACE VIEW dbt.project AS SELECT * FROM read_parquet('dbt.project.parquet'); +CREATE OR REPLACE VIEW dbt.packages AS SELECT * FROM read_parquet('dbt.packages.parquet'); +CREATE OR REPLACE VIEW dbt.project_vars AS SELECT * FROM read_parquet('dbt.project_vars.parquet'); +CREATE OR REPLACE VIEW dbt.project_env_vars AS SELECT * FROM read_parquet('dbt.project_env_vars.parquet'); +CREATE OR REPLACE VIEW dbt.models AS SELECT * FROM read_parquet('dbt.models.parquet'); +CREATE OR REPLACE VIEW dbt.seeds AS SELECT * FROM read_parquet('dbt.seeds.parquet'); +CREATE OR REPLACE VIEW dbt.snapshots AS SELECT * FROM read_parquet('dbt.snapshots.parquet'); +CREATE OR REPLACE VIEW dbt.functions AS SELECT * FROM read_parquet('dbt.functions.parquet'); +CREATE OR REPLACE VIEW dbt.analyses AS SELECT * FROM read_parquet('dbt.analyses.parquet'); +CREATE OR REPLACE VIEW dbt.hooks AS SELECT * FROM read_parquet('dbt.hooks.parquet'); +CREATE OR REPLACE VIEW dbt.checks AS SELECT * FROM read_parquet('dbt.checks.parquet'); +CREATE OR REPLACE VIEW dbt.sources AS SELECT * FROM read_parquet('dbt.sources.parquet'); +CREATE OR REPLACE VIEW dbt.data_tests AS SELECT * FROM read_parquet('dbt.data_tests.parquet'); +CREATE OR REPLACE VIEW dbt.unit_tests AS SELECT * FROM read_parquet('dbt.unit_tests.parquet'); +CREATE OR REPLACE VIEW dbt.macros AS SELECT * FROM read_parquet('dbt.macros.parquet'); +CREATE OR REPLACE VIEW dbt.groups AS SELECT * FROM read_parquet('dbt.groups.parquet'); +CREATE OR REPLACE VIEW dbt.exposures AS SELECT * FROM read_parquet('dbt.exposures.parquet'); +CREATE OR REPLACE VIEW dbt.metrics AS SELECT * FROM read_parquet('dbt.metrics.parquet'); +CREATE OR REPLACE VIEW dbt.docs_blocks AS SELECT * FROM read_parquet('dbt.docs_blocks.parquet'); +CREATE OR REPLACE VIEW dbt.saved_queries AS SELECT * FROM read_parquet('dbt.saved_queries.parquet'); +CREATE OR REPLACE VIEW dbt.semantic_models AS SELECT * FROM read_parquet('dbt.semantic_models.parquet'); +CREATE OR REPLACE VIEW dbt.semantic_entities AS SELECT * FROM read_parquet('dbt.semantic_entities.parquet'); +CREATE OR REPLACE VIEW dbt.semantic_measures AS SELECT * FROM read_parquet('dbt.semantic_measures.parquet'); +CREATE OR REPLACE VIEW dbt.semantic_dimensions AS SELECT * FROM read_parquet('dbt.semantic_dimensions.parquet'); +CREATE OR REPLACE VIEW dbt.semantic_relationships AS SELECT * FROM read_parquet('dbt.semantic_relationships.parquet'); +CREATE OR REPLACE VIEW dbt.time_spines AS SELECT * FROM read_parquet('dbt.time_spines.parquet'); +CREATE OR REPLACE VIEW dbt.dag_nodes AS SELECT * FROM read_parquet('dbt.dag_nodes.parquet'); +CREATE OR REPLACE VIEW dbt.edges AS SELECT * FROM read_parquet('dbt.edges.parquet'); +CREATE OR REPLACE VIEW dbt.node_columns AS SELECT * FROM read_parquet('dbt.node_columns.parquet'); +CREATE OR REPLACE VIEW dbt.column_lineage AS SELECT * FROM read_parquet('dbt.column_lineage.parquet'); +CREATE OR REPLACE VIEW dbt.classifiers AS SELECT * FROM read_parquet('dbt.classifiers.parquet'); + +CREATE OR REPLACE VIEW dbt_rt.invocations AS SELECT * FROM read_parquet('dbt_rt.invocations.parquet'); +CREATE OR REPLACE VIEW dbt_rt.run_results AS SELECT * FROM read_parquet('dbt_rt.run_results.parquet'); +CREATE OR REPLACE VIEW dbt_rt.freshness AS SELECT * FROM read_parquet('dbt_rt.freshness.parquet'); +CREATE OR REPLACE VIEW dbt_rt.relations AS SELECT * FROM read_parquet('dbt_rt.relations.parquet'); +CREATE OR REPLACE VIEW dbt_rt.diagnostics AS SELECT * FROM read_parquet('dbt_rt.diagnostics.parquet'); +CREATE OR REPLACE VIEW dbt_rt.adapter_queries AS SELECT * FROM read_parquet('dbt_rt.adapter_queries.parquet'); + +CREATE OR REPLACE VIEW dbt_internal.node_input_files AS SELECT * FROM read_parquet('dbt_internal.node_input_files.parquet'); + +CREATE OR REPLACE VIEW dbt_rt.run_results_latest AS +SELECT * FROM dbt_rt.run_results +WHERE NOT (status = 'error' AND execution_time = 0) +QUALIFY ROW_NUMBER() OVER (PARTITION BY unique_id ORDER BY created_at DESC) = 1; + +CREATE OR REPLACE VIEW dbt_internal.resources AS +SELECT * FROM dbt.models +UNION ALL BY NAME SELECT * FROM dbt.seeds +UNION ALL BY NAME SELECT * FROM dbt.snapshots +UNION ALL BY NAME SELECT * FROM dbt.functions +UNION ALL BY NAME SELECT * FROM dbt.analyses +UNION ALL BY NAME SELECT * FROM dbt.hooks +UNION ALL BY NAME SELECT * FROM dbt.checks +UNION ALL BY NAME SELECT * FROM dbt.sources +UNION ALL BY NAME SELECT *, 'test' AS resource_type FROM dbt.data_tests; + diff --git a/tests/fixtures/jaffle_shop_v2/manifest.json b/tests/fixtures/jaffle_shop_v2/manifest.json new file mode 100644 index 0000000..47adf30 --- /dev/null +++ b/tests/fixtures/jaffle_shop_v2/manifest.json @@ -0,0 +1,26302 @@ +{ + "metadata": { + "dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json", + "dbt_version": "2.0.11", + "generated_at": "2026-11-14T07:50:19.345552Z", + "invocation_id": "0ecfc4e4-d9cb-4e9c-9194-69ffaedff19c", + "invocation_started_at": "2026-11-14T07:50:18.545281Z", + "env": {}, + "project_name": "jaffle_shop", + "project_id": "06e5b98c2db46f8a72cc4f66410e9b3b", + "user_id": null, + "send_anonymous_usage_stats": null, + "adapter_type": "duckdb", + "quoting": { + "database": true, + "identifier": true, + "schema": true + } + }, + "nodes": { + "model.jaffle_shop.customers": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.customers", + "database": "jaffle", + "schema": "main", + "name": "customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "customers" + ], + "path": "marts/customers.sql", + "original_file_path": "models/marts/customers.sql", + "patch_path": "jaffle_shop://models/marts/customers.yml", + "description": "Customer overview data mart, offering key details for each unique customer. One row per customer.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "customers", + "relation_name": "\"jaffle\".\"main\".\"customers\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/customers.sql", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "The unique key of the orders mart.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "customer", + "description": "The unique key of the orders mart." + } + }, + "customer_name": { + "name": "customer_name", + "description": "Customers' full name.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "customer_name", + "description": "Customers' full name." + } + }, + "count_lifetime_orders": { + "name": "count_lifetime_orders", + "description": "Total number of orders a customer has ever placed.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "first_ordered_at": { + "name": "first_ordered_at", + "description": "The timestamp when a customer placed their first order.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "time", + "name": "first_ordered_at", + "description": "The timestamp when a customer placed their first order." + }, + "granularity": "day" + }, + "last_ordered_at": { + "name": "last_ordered_at", + "description": "The timestamp of a customer's most recent order.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "time", + "name": "last_ordered_at", + "description": "The timestamp of a customer's most recent order." + }, + "granularity": "day" + }, + "lifetime_spend_pretax": { + "name": "lifetime_spend_pretax", + "description": "The sum of all the pre-tax subtotals of every order a customer has placed.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "lifetime_tax_paid": { + "name": "lifetime_tax_paid", + "description": "The sum of all the tax portion of every order a customer has placed.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "lifetime_spend": { + "name": "lifetime_spend", + "description": "The sum of all the order totals (including tax) that a customer has ever placed.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "customer_type": { + "name": "customer_type", + "description": "Options are 'new' or 'returning', indicating if a customer has ordered more than once or has only placed their first order to date.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "customer_type", + "description": "Options are 'new' or 'returning', indicating if a customer has ordered more than once or has only placed their first order to date." + } + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_customers", + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_customers", + { + "line": 5, + "col": 19, + "index": 40, + "file": "models/marts/customers.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.orders", + { + "line": 11, + "col": 19, + "index": 103, + "file": "models/marts/customers.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_customers", + "package": null, + "version": null + }, + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\ncustomers as (\n\n select * from {{ ref('stg_customers') }}\n\n),\n\norders as (\n\n select * from {{ ref('orders') }}\n\n),\n\ncustomer_orders_summary as (\n\n select\n orders.customer_id,\n\n count(distinct orders.order_id) as count_lifetime_orders,\n count(distinct orders.order_id) > 1 as is_repeat_buyer,\n min(orders.ordered_at) as first_ordered_at,\n max(orders.ordered_at) as last_ordered_at,\n sum(orders.subtotal) as lifetime_spend_pretax,\n sum(orders.tax_paid) as lifetime_tax_paid,\n sum(orders.order_total) as lifetime_spend\n\n from orders\n\n group by 1\n\n),\n\njoined as (\n\n select\n customers.*,\n\n customer_orders_summary.count_lifetime_orders,\n customer_orders_summary.first_ordered_at,\n customer_orders_summary.last_ordered_at,\n customer_orders_summary.lifetime_spend_pretax,\n customer_orders_summary.lifetime_tax_paid,\n customer_orders_summary.lifetime_spend,\n\n case\n when customer_orders_summary.is_repeat_buyer then 'returning'\n else 'new'\n end as customer_type\n\n from customers\n\n left join customer_orders_summary\n on customers.customer_id = customer_orders_summary.customer_id\n\n)\n\nselect * from joined", + "compiled": true, + "compiled_code": "with\n\ncustomers as (\n\n select * from \"jaffle\".\"main\".\"stg_customers\"\n\n),\n\norders as (\n\n select * from \"jaffle\".\"main\".\"orders\"\n\n),\n\ncustomer_orders_summary as (\n\n select\n orders.customer_id,\n\n count(distinct orders.order_id) as count_lifetime_orders,\n count(distinct orders.order_id) > 1 as is_repeat_buyer,\n min(orders.ordered_at) as first_ordered_at,\n max(orders.ordered_at) as last_ordered_at,\n sum(orders.subtotal) as lifetime_spend_pretax,\n sum(orders.tax_paid) as lifetime_tax_paid,\n sum(orders.order_total) as lifetime_spend\n\n from orders\n\n group by 1\n\n),\n\njoined as (\n\n select\n customers.*,\n\n customer_orders_summary.count_lifetime_orders,\n customer_orders_summary.first_ordered_at,\n customer_orders_summary.last_ordered_at,\n customer_orders_summary.lifetime_spend_pretax,\n customer_orders_summary.lifetime_tax_paid,\n customer_orders_summary.lifetime_spend,\n\n case\n when customer_orders_summary.is_repeat_buyer then 'returning'\n else 'new'\n end as customer_type\n\n from customers\n\n left join customer_orders_summary\n on customers.customer_id = customer_orders_summary.customer_id\n\n)\n\nselect * from joined", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "99eff7e87bcb1209d406ed442a2b5b957020fc99b0fb7ff7230be09193a7d4c6" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "customer_id" + ] + }, + "model.jaffle_shop.locations": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.locations", + "database": "jaffle", + "schema": "main", + "name": "locations", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "locations" + ], + "path": "marts/locations.sql", + "original_file_path": "models/marts/locations.sql", + "patch_path": "jaffle_shop://models/marts/locations.yml", + "description": "Location dimension table. The grain of the table is one row per location.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "locations", + "relation_name": "\"jaffle\".\"main\".\"locations\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/locations.sql", + "columns": { + "location_id": { + "name": "location_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "location" + } + }, + "location_name": { + "name": "location_name", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "location_name" + } + }, + "opened_date": { + "name": "opened_date", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "time", + "name": "opened_date" + }, + "granularity": "day" + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_locations" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_locations", + { + "line": 5, + "col": 19, + "index": 40, + "file": "models/marts/locations.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_locations", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\nlocations as (\n\n select * from {{ ref('stg_locations') }}\n\n)\n\nselect * from locations", + "compiled": true, + "compiled_code": "with\n\nlocations as (\n\n select * from \"jaffle\".\"main\".\"stg_locations\"\n\n)\n\nselect * from locations", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "1d3d9ee20be71938907012f387d919a6efd14586ccae6641453266bd5235490d" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [] + }, + "model.jaffle_shop.metricflow_time_spine": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.metricflow_time_spine", + "database": "jaffle", + "schema": "main", + "name": "metricflow_time_spine", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "metricflow_time_spine" + ], + "path": "marts/metricflow_time_spine.sql", + "original_file_path": "models/marts/metricflow_time_spine.sql", + "patch_path": "jaffle_shop://models/marts/metricflow_time_spine.yml", + "description": "Time spine model used by MetricFlow for temporal joins and aggregations.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "metricflow_time_spine", + "relation_name": "\"jaffle\".\"main\".\"metricflow_time_spine\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/metricflow_time_spine.sql", + "columns": { + "date_day": { + "name": "date_day", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "granularity": "day" + } + }, + "depends_on": { + "macros": [ + "macro.dbt.date_spine", + "macro.dbt.dateadd", + "macro.dbt.generate_series", + "macro.dbt.get_intervals_between", + "macro.dbt.statement" + ], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "raw_code": "{{\n config(\n materialized = 'table',\n )\n}}\n\nwith days as (\n\n {{\n dbt.date_spine(\n 'day',\n \"cast('2000-01-01' as date)\",\n \"cast('2030-01-01' as date)\"\n )\n }}\n\n),\n\nfinal as (\n select cast(date_day as date) as date_day\n from days\n)\n\nselect * from final", + "compiled": true, + "compiled_code": "\n\nwith days as (\n\n \n\n\n \n\n\n with rawdata as (\n\n \n select\n generate_series as generated_number\n from generate_series(1, 10958)\n\n\n ),\n\n all_periods as (\n\n select (\n \n\n (cast('2000-01-01' as date) + cast(row_number() over (order by 1) - 1 as bigint) * interval 1 day)\n ) as date_day\n from rawdata\n\n ),\n\n filtered as (\n\n select *\n from all_periods\n where date_day <= cast('2030-01-01' as date)\n\n )\n\n select * from filtered\n\n\n\n),\n\nfinal as (\n select cast(date_day as date) as date_day\n from days\n)\n\nselect * from final", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "7ac589204cecb0acdc621fa6d9679795a6cb486611b0e02b3c1f83bc306149d6" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [], + "time_spine": { + "custom_granularities": [], + "standard_granularity_column": "date_day" + } + }, + "model.jaffle_shop.order_items": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.order_items", + "database": "jaffle", + "schema": "main", + "name": "order_items", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_items" + ], + "path": "marts/order_items.sql", + "original_file_path": "models/marts/order_items.sql", + "patch_path": "jaffle_shop://models/marts/order_items.yml", + "description": "Items contained in each order. The grain of the table is one row per order item.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "order_items", + "relation_name": "\"jaffle\".\"main\".\"order_items\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/order_items.sql", + "columns": { + "order_item_id": { + "name": "order_item_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "order_item" + } + }, + "order_id": { + "name": "order_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "foreign", + "name": "order_id" + } + }, + "product_id": { + "name": "product_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "foreign", + "name": "product" + } + }, + "ordered_at": { + "name": "ordered_at", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "time", + "name": "ordered_at" + }, + "granularity": "day" + }, + "is_food_item": { + "name": "is_food_item", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_food_item" + } + }, + "is_drink_item": { + "name": "is_drink_item", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_drink_item" + } + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_order_items", + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_products", + "model.jaffle_shop.stg_supplies" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_order_items", + { + "line": 5, + "col": 19, + "index": 42, + "file": "models/marts/order_items.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.stg_orders", + { + "line": 12, + "col": 19, + "index": 108, + "file": "models/marts/order_items.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.stg_products", + { + "line": 18, + "col": 19, + "index": 170, + "file": "models/marts/order_items.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.stg_supplies", + { + "line": 24, + "col": 19, + "index": 234, + "file": "models/marts/order_items.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_order_items", + "package": null, + "version": null + }, + { + "name": "stg_orders", + "package": null, + "version": null + }, + { + "name": "stg_products", + "package": null, + "version": null + }, + { + "name": "stg_supplies", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\norder_items as (\n\n select * from {{ ref('stg_order_items') }}\n\n),\n\n\norders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\nproducts as (\n\n select * from {{ ref('stg_products') }}\n\n),\n\nsupplies as (\n\n select * from {{ ref('stg_supplies') }}\n\n),\n\norder_supplies_summary as (\n\n select\n product_id,\n\n sum(supply_cost) as supply_cost\n\n from supplies\n\n group by 1\n\n),\n\njoined as (\n\n select\n order_items.*,\n\n orders.ordered_at,\n\n products.product_name,\n products.product_price,\n products.is_food_item,\n products.is_drink_item,\n\n order_supplies_summary.supply_cost\n\n from order_items\n\n left join orders on order_items.order_id = orders.order_id\n\n left join products on order_items.product_id = products.product_id\n\n left join order_supplies_summary\n on order_items.product_id = order_supplies_summary.product_id\n\n)\n\nselect * from joined", + "compiled": true, + "compiled_code": "with\n\norder_items as (\n\n select * from \"jaffle\".\"main\".\"stg_order_items\"\n\n),\n\n\norders as (\n\n select * from \"jaffle\".\"main\".\"stg_orders\"\n\n),\n\nproducts as (\n\n select * from \"jaffle\".\"main\".\"stg_products\"\n\n),\n\nsupplies as (\n\n select * from \"jaffle\".\"main\".\"stg_supplies\"\n\n),\n\norder_supplies_summary as (\n\n select\n product_id,\n\n sum(supply_cost) as supply_cost\n\n from supplies\n\n group by 1\n\n),\n\njoined as (\n\n select\n order_items.*,\n\n orders.ordered_at,\n\n products.product_name,\n products.product_price,\n products.is_food_item,\n products.is_drink_item,\n\n order_supplies_summary.supply_cost\n\n from order_items\n\n left join orders on order_items.order_id = orders.order_id\n\n left join products on order_items.product_id = products.product_id\n\n left join order_supplies_summary\n on order_items.product_id = order_supplies_summary.product_id\n\n)\n\nselect * from joined", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "69ee5eb2cd03225dee211923a154fdfaf43c6fe65185203151afc03dbc88932c" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "order_item_id" + ] + }, + "model.jaffle_shop.orders": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.orders", + "database": "jaffle", + "schema": "main", + "name": "orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "orders" + ], + "path": "marts/orders.sql", + "original_file_path": "models/marts/orders.sql", + "patch_path": "jaffle_shop://models/marts/orders.yml", + "description": "Order overview data mart, offering key details for each order inlcluding if it's a customer's first order and a food vs. drink item breakdown. One row per order.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "orders", + "relation_name": "\"jaffle\".\"main\".\"orders\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/orders.sql", + "columns": { + "order_id": { + "name": "order_id", + "description": "The unique key of the orders mart.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "order_id", + "description": "The unique key of the orders mart." + } + }, + "customer_id": { + "name": "customer_id", + "description": "The foreign key relating to the customer who placed the order.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "foreign", + "name": "customer", + "description": "The foreign key relating to the customer who placed the order." + } + }, + "location_id": { + "name": "location_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "foreign", + "name": "location" + } + }, + "order_total": { + "name": "order_total", + "description": "The total amount of the order in USD including tax.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "order_total_dim", + "description": "The total amount of the order in USD including tax." + } + }, + "ordered_at": { + "name": "ordered_at", + "description": "The timestamp the order was placed at.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "time", + "name": "ordered_at", + "description": "The timestamp the order was placed at." + }, + "granularity": "day" + }, + "order_cost": { + "name": "order_cost", + "description": "The sum of supply expenses to fulfill the order.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "is_food_order": { + "name": "is_food_order", + "description": "A boolean indicating if this order included any food items.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_food_order", + "description": "A boolean indicating if this order included any food items." + } + }, + "is_drink_order": { + "name": "is_drink_order", + "description": "A boolean indicating if this order included any drink items.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_drink_order", + "description": "A boolean indicating if this order included any drink items." + } + }, + "customer_order_number": { + "name": "customer_order_number", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "customer_order_number" + } + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_orders", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/marts/orders.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.order_items", + { + "line": 11, + "col": 19, + "index": 102, + "file": "models/marts/orders.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_orders", + "package": null, + "version": null + }, + { + "name": "order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\norders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\norder_items as (\n\n select * from {{ ref('order_items') }}\n\n),\n\norder_items_summary as (\n\n select\n order_id,\n\n sum(supply_cost) as order_cost,\n sum(product_price) as order_items_subtotal,\n count(order_item_id) as count_order_items,\n sum(\n case\n when is_food_item then 1\n else 0\n end\n ) as count_food_items,\n sum(\n case\n when is_drink_item then 1\n else 0\n end\n ) as count_drink_items\n\n from order_items\n\n group by 1\n\n),\n\ncompute_booleans as (\n\n select\n orders.*,\n\n order_items_summary.order_cost,\n order_items_summary.order_items_subtotal,\n order_items_summary.count_food_items,\n order_items_summary.count_drink_items,\n order_items_summary.count_order_items,\n order_items_summary.count_food_items > 0 as is_food_order,\n order_items_summary.count_drink_items > 0 as is_drink_order\n\n from orders\n\n left join\n order_items_summary\n on orders.order_id = order_items_summary.order_id\n\n),\n\ncustomer_order_count as (\n\n select\n *,\n\n row_number() over (\n partition by customer_id\n order by ordered_at asc\n ) as customer_order_number\n\n from compute_booleans\n\n)\n\nselect * from customer_order_count", + "compiled": true, + "compiled_code": "with\n\norders as (\n\n select * from \"jaffle\".\"main\".\"stg_orders\"\n\n),\n\norder_items as (\n\n select * from \"jaffle\".\"main\".\"order_items\"\n\n),\n\norder_items_summary as (\n\n select\n order_id,\n\n sum(supply_cost) as order_cost,\n sum(product_price) as order_items_subtotal,\n count(order_item_id) as count_order_items,\n sum(\n case\n when is_food_item then 1\n else 0\n end\n ) as count_food_items,\n sum(\n case\n when is_drink_item then 1\n else 0\n end\n ) as count_drink_items\n\n from order_items\n\n group by 1\n\n),\n\ncompute_booleans as (\n\n select\n orders.*,\n\n order_items_summary.order_cost,\n order_items_summary.order_items_subtotal,\n order_items_summary.count_food_items,\n order_items_summary.count_drink_items,\n order_items_summary.count_order_items,\n order_items_summary.count_food_items > 0 as is_food_order,\n order_items_summary.count_drink_items > 0 as is_drink_order\n\n from orders\n\n left join\n order_items_summary\n on orders.order_id = order_items_summary.order_id\n\n),\n\ncustomer_order_count as (\n\n select\n *,\n\n row_number() over (\n partition by customer_id\n order by ordered_at asc\n ) as customer_order_number\n\n from compute_booleans\n\n)\n\nselect * from customer_order_count", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "61e17f8b9d80475afa49198ffb4bc2dca193aabf42cb9af3b8d1afcef9ad7b2e" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "order_id" + ] + }, + "model.jaffle_shop.products": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.products", + "database": "jaffle", + "schema": "main", + "name": "products", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "products" + ], + "path": "marts/products.sql", + "original_file_path": "models/marts/products.sql", + "patch_path": "jaffle_shop://models/marts/products.yml", + "description": "Product dimension table. The grain of the table is one row per product.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "products", + "relation_name": "\"jaffle\".\"main\".\"products\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/products.sql", + "columns": { + "product_id": { + "name": "product_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "product" + } + }, + "product_name": { + "name": "product_name", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "product_name" + } + }, + "product_type": { + "name": "product_type", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "product_type" + } + }, + "product_description": { + "name": "product_description", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "product_description" + } + }, + "is_food_item": { + "name": "is_food_item", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_food_item" + } + }, + "is_drink_item": { + "name": "is_drink_item", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_drink_item" + } + }, + "product_price": { + "name": "product_price", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "product_price" + } + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_products" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_products", + { + "line": 5, + "col": 19, + "index": 39, + "file": "models/marts/products.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_products", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\nproducts as (\n\n select * from {{ ref('stg_products') }}\n\n)\n\nselect * from products", + "compiled": true, + "compiled_code": "with\n\nproducts as (\n\n select * from \"jaffle\".\"main\".\"stg_products\"\n\n)\n\nselect * from products", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "f8cce79698b13f8a513398ed0fb931879335c4d9b4fdd423f1067bb86ab68143" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [] + }, + "model.jaffle_shop.stg_customers": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_customers", + "database": "jaffle", + "schema": "main", + "name": "stg_customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_customers" + ], + "path": "staging/stg_customers.sql", + "original_file_path": "models/staging/stg_customers.sql", + "patch_path": "jaffle_shop://models/staging/stg_customers.yml", + "description": "Customer data with basic cleaning and transformation applied, one row per customer.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_customers", + "relation_name": "\"jaffle\".\"main\".\"stg_customers\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_customers.sql", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "The unique key for each customer.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "source.jaffle_shop.ecom.raw_customers" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_customers", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_customers.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_customers" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_customers') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as customer_id,\n\n ---------- text\n name as customer_name\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_customers\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as customer_id,\n\n ---------- text\n name as customer_name\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "84a0fec373bce260649e3ad0afa4a69501bca8564494f5561c298f5019288f7b" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "customer_id" + ] + }, + "model.jaffle_shop.stg_locations": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_locations", + "database": "jaffle", + "schema": "main", + "name": "stg_locations", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_locations" + ], + "path": "staging/stg_locations.sql", + "original_file_path": "models/staging/stg_locations.sql", + "patch_path": "jaffle_shop://models/staging/stg_locations.yml", + "description": "List of open locations with basic cleaning and transformation applied, one row per location.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_locations", + "relation_name": "\"jaffle\".\"main\".\"stg_locations\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_locations.sql", + "columns": { + "location_id": { + "name": "location_id", + "description": "The unique key for each location.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [ + "macro.dbt.date_trunc" + ], + "nodes": [ + "source.jaffle_shop.ecom.raw_stores" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_stores", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_locations.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_stores" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_stores') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as location_id,\n\n ---------- text\n name as location_name,\n\n ---------- numerics\n tax_rate,\n\n ---------- timestamps\n {{ dbt.date_trunc('day', 'opened_at') }} as opened_date\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_stores\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as location_id,\n\n ---------- text\n name as location_name,\n\n ---------- numerics\n tax_rate,\n\n ---------- timestamps\n date_trunc('day', opened_at) as opened_date\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "f42df08c1b7dc099e7f25f96a072a996df7da62f07c5f34a621ebbab02958fd3" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "location_id" + ] + }, + "model.jaffle_shop.stg_order_items": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_order_items", + "database": "jaffle", + "schema": "main", + "name": "stg_order_items", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_order_items" + ], + "path": "staging/stg_order_items.sql", + "original_file_path": "models/staging/stg_order_items.sql", + "patch_path": "jaffle_shop://models/staging/stg_order_items.yml", + "description": "Individual food and drink items that make up our orders, one row per item.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_order_items", + "relation_name": "\"jaffle\".\"main\".\"stg_order_items\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_order_items.sql", + "columns": { + "order_item_id": { + "name": "order_item_id", + "description": "The unique key for each order item.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + }, + "order_id": { + "name": "order_id", + "description": "The corresponding order each order item belongs to", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "source.jaffle_shop.ecom.raw_items" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_items", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_order_items.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_items" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_items') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_item_id,\n order_id,\n sku as product_id\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_items\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_item_id,\n order_id,\n sku as product_id\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "3cbe0d9fb05ebdc010ddce01ea426a48aa96207e07dd1d3f8cc5fb06f215c797" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "order_item_id" + ] + }, + "model.jaffle_shop.stg_orders": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_orders", + "database": "jaffle", + "schema": "main", + "name": "stg_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_orders" + ], + "path": "staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "patch_path": "jaffle_shop://models/staging/stg_orders.yml", + "description": "Order data with basic cleaning and transformation applied, one row per order.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_orders", + "relation_name": "\"jaffle\".\"main\".\"stg_orders\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_orders.sql", + "columns": { + "order_id": { + "name": "order_id", + "description": "The unique key for each order.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [ + "macro.dbt.date_trunc", + "macro.jaffle_shop.cents_to_dollars" + ], + "nodes": [ + "source.jaffle_shop.ecom.raw_orders" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_orders", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_orders.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_orders" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_orders') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_id,\n store_id as location_id,\n customer as customer_id,\n\n ---------- numerics\n subtotal as subtotal_cents,\n tax_paid as tax_paid_cents,\n order_total as order_total_cents,\n {{ cents_to_dollars('subtotal') }} as subtotal,\n {{ cents_to_dollars('tax_paid') }} as tax_paid,\n {{ cents_to_dollars('order_total') }} as order_total,\n\n ---------- timestamps\n {{ dbt.date_trunc('day','ordered_at') }} as ordered_at\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_orders\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_id,\n store_id as location_id,\n customer as customer_id,\n\n ---------- numerics\n subtotal as subtotal_cents,\n tax_paid as tax_paid_cents,\n order_total as order_total_cents,\n (subtotal / 100)::numeric(16, 2) as subtotal,\n (tax_paid / 100)::numeric(16, 2) as tax_paid,\n (order_total / 100)::numeric(16, 2) as order_total,\n\n ---------- timestamps\n date_trunc('day', ordered_at) as ordered_at\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "2e6ef255075b7033533a247089e6a2b53f0d003387dc1ba0ac3b360a7abe09f2" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "order_id" + ] + }, + "model.jaffle_shop.stg_products": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_products", + "database": "jaffle", + "schema": "main", + "name": "stg_products", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_products" + ], + "path": "staging/stg_products.sql", + "original_file_path": "models/staging/stg_products.sql", + "patch_path": "jaffle_shop://models/staging/stg_products.yml", + "description": "Product (food and drink items that can be ordered) data with basic cleaning and transformation applied, one row per product.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_products", + "relation_name": "\"jaffle\".\"main\".\"stg_products\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_products.sql", + "columns": { + "product_id": { + "name": "product_id", + "description": "The unique key for each product.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [ + "macro.jaffle_shop.cents_to_dollars" + ], + "nodes": [ + "source.jaffle_shop.ecom.raw_products" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_products", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_products.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_products" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_products') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n sku as product_id,\n\n ---------- text\n name as product_name,\n type as product_type,\n description as product_description,\n\n\n ---------- numerics\n {{ cents_to_dollars('price') }} as product_price,\n\n ---------- booleans\n coalesce(type = 'jaffle', false) as is_food_item,\n\n coalesce(type = 'beverage', false) as is_drink_item\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_products\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n sku as product_id,\n\n ---------- text\n name as product_name,\n type as product_type,\n description as product_description,\n\n\n ---------- numerics\n (price / 100)::numeric(16, 2) as product_price,\n\n ---------- booleans\n coalesce(type = 'jaffle', false) as is_food_item,\n\n coalesce(type = 'beverage', false) as is_drink_item\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "e5b7c0e2b9f27c6f73adae81f4389ee951f8977ea259297da5046a115ecd05c5" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "product_id" + ] + }, + "model.jaffle_shop.stg_supplies": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.stg_supplies", + "database": "jaffle", + "schema": "main", + "name": "stg_supplies", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_supplies" + ], + "path": "staging/stg_supplies.sql", + "original_file_path": "models/staging/stg_supplies.sql", + "patch_path": "jaffle_shop://models/staging/stg_supplies.yml", + "description": "List of our supply expenses data with basic cleaning and transformation applied.\nOne row per supply cost, not per supply. As supply costs fluctuate they receive a new row with a new UUID. Thus there can be multiple rows per supply_id.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "stg_supplies", + "relation_name": "\"jaffle\".\"main\".\"stg_supplies\"", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_supplies.sql", + "columns": { + "supply_uuid": { + "name": "supply_uuid", + "description": "The unique key of our supplies per cost.", + "constraints": [], + "meta": {}, + "tags": [], + "config": {} + } + }, + "depends_on": { + "macros": [ + "macro.dbt.concat", + "macro.dbt.hash", + "macro.dbt.type_string", + "macro.dbt_utils.generate_surrogate_key", + "macro.jaffle_shop.cents_to_dollars" + ], + "nodes": [ + "source.jaffle_shop.ecom.raw_supplies" + ], + "nodes_with_ref_location": [ + [ + "source.jaffle_shop.ecom.raw_supplies", + { + "line": 5, + "col": 19, + "index": 37, + "file": "models/staging/stg_supplies.sql", + "expanded": null + } + ] + ] + }, + "refs": [], + "sources": [ + [ + "ecom", + "raw_supplies" + ] + ], + "functions": [], + "raw_code": "with\n\nsource as (\n\n select * from {{ source('ecom', 'raw_supplies') }}\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n {{ dbt_utils.generate_surrogate_key(['id', 'sku']) }} as supply_uuid,\n id as supply_id,\n sku as product_id,\n\n ---------- text\n name as supply_name,\n\n ---------- numerics\n {{ cents_to_dollars('cost') }} as supply_cost,\n\n ---------- booleans\n perishable as is_perishable_supply\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_supplies\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n md5(cast(coalesce(cast(id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(sku as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as supply_uuid,\n id as supply_id,\n sku as product_id,\n\n ---------- text\n name as supply_name,\n\n ---------- numerics\n (cost / 100)::numeric(16, 2) as supply_cost,\n\n ---------- booleans\n perishable as is_perishable_supply\n\n from source\n\n)\n\nselect * from renamed", + "unrendered_config": { + "materialized": "view" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "07f6e9f96161d194cee53f04a2ba502f4d00b0bb69445087d5f6d2e760fa596a" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "view", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [ + "supply_uuid" + ] + }, + "model.jaffle_shop.supplies": { + "resource_type": "model", + "unique_id": "model.jaffle_shop.supplies", + "database": "jaffle", + "schema": "main", + "name": "supplies", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "supplies" + ], + "path": "marts/supplies.sql", + "original_file_path": "models/marts/supplies.sql", + "patch_path": "jaffle_shop://models/marts/supplies.yml", + "description": "Supplies dimension table. The grain of the table is one row per supply and product combination.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "supplies", + "relation_name": "\"jaffle\".\"main\".\"supplies\"", + "compiled_path": "target/compiled/jaffle_shop/models/marts/supplies.sql", + "columns": { + "supply_uuid": { + "name": "supply_uuid", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "entity": { + "type": "primary", + "name": "supply" + } + }, + "supply_id": { + "name": "supply_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "supply_id" + } + }, + "product_id": { + "name": "product_id", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "product_id" + } + }, + "supply_name": { + "name": "supply_name", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "supply_name" + } + }, + "supply_cost": { + "name": "supply_cost", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "supply_cost" + } + }, + "is_perishable_supply": { + "name": "is_perishable_supply", + "description": "", + "constraints": [], + "meta": {}, + "tags": [], + "config": {}, + "dimension": { + "type": "categorical", + "name": "is_perishable_supply" + } + } + }, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_supplies" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_supplies", + { + "line": 5, + "col": 19, + "index": 39, + "file": "models/marts/supplies.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_supplies", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "with\n\nsupplies as (\n\n select * from {{ ref('stg_supplies') }}\n\n)\n\nselect * from supplies", + "compiled": true, + "compiled_code": "with\n\nsupplies as (\n\n select * from \"jaffle\".\"main\".\"stg_supplies\"\n\n)\n\nselect * from supplies", + "unrendered_config": { + "materialized": "table" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "462bb490d361154f566181cc2bce525b9e1d71ff559618a7b54f9ecffc75c2b9" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "access": "protected", + "config": { + "enabled": true, + "alias": null, + "database": null, + "schema": null, + "tags": [], + "classifiers": [], + "meta": {}, + "group": null, + "materialized": "table", + "incremental_strategy": null, + "batch_size": null, + "lookback": 1, + "begin": null, + "persist_docs": {}, + "post-hook": [], + "pre-hook": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "column_types": {}, + "full_refresh": null, + "unique_key": null, + "on_schema_change": null, + "on_configuration_change": "apply", + "on_error": null, + "grants": {}, + "packages": [], + "docs": { + "show": true, + "node_color": null + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "event_time": null, + "concurrent_batches": null, + "access": "protected", + "static_analysis": "strict", + "freshness": null, + "latest_version_pointer": { + "enabled": null, + "alias": null + } + }, + "version": null, + "latest_version": null, + "constraints": [], + "primary_key": [] + }, + "seed.jaffle_shop.raw_customers": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_customers", + "database": "jaffle", + "schema": "raw", + "name": "raw_customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_customers" + ], + "path": "jaffle-data/raw_customers.csv", + "original_file_path": "seeds/jaffle-data/raw_customers.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_customers", + "relation_name": "\"jaffle\".\"raw\".\"raw_customers\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "ed25f345830bc44c2e920631ca5ca3f11edaa30d02a019d6db817c1aaf3770bb" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "seed.jaffle_shop.raw_items": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_items", + "database": "jaffle", + "schema": "raw", + "name": "raw_items", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_items" + ], + "path": "jaffle-data/raw_items.csv", + "original_file_path": "seeds/jaffle-data/raw_items.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_items", + "relation_name": "\"jaffle\".\"raw\".\"raw_items\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "path", + "checksum": "seeds/jaffle-data/raw_items.csv" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "seed.jaffle_shop.raw_orders": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_orders", + "database": "jaffle", + "schema": "raw", + "name": "raw_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_orders" + ], + "path": "jaffle-data/raw_orders.csv", + "original_file_path": "seeds/jaffle-data/raw_orders.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_orders", + "relation_name": "\"jaffle\".\"raw\".\"raw_orders\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "path", + "checksum": "seeds/jaffle-data/raw_orders.csv" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "seed.jaffle_shop.raw_products": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_products", + "database": "jaffle", + "schema": "raw", + "name": "raw_products", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_products" + ], + "path": "jaffle-data/raw_products.csv", + "original_file_path": "seeds/jaffle-data/raw_products.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_products", + "relation_name": "\"jaffle\".\"raw\".\"raw_products\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "dcd5566cf769cfbad0b67365a43d13ed943511039b4bed3126f987db37be6adf" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "seed.jaffle_shop.raw_stores": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_stores", + "database": "jaffle", + "schema": "raw", + "name": "raw_stores", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_stores" + ], + "path": "jaffle-data/raw_stores.csv", + "original_file_path": "seeds/jaffle-data/raw_stores.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_stores", + "relation_name": "\"jaffle\".\"raw\".\"raw_stores\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "88012c7ac0a2fb3c50ef502e0ba96ac6b8ab41aafb8c95034e76753a78128d9c" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "seed.jaffle_shop.raw_supplies": { + "resource_type": "seed", + "unique_id": "seed.jaffle_shop.raw_supplies", + "database": "jaffle", + "schema": "raw", + "name": "raw_supplies", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "jaffle-data", + "raw_supplies" + ], + "path": "jaffle-data/raw_supplies.csv", + "original_file_path": "seeds/jaffle-data/raw_supplies.csv", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "raw_supplies", + "relation_name": "\"jaffle\".\"raw\".\"raw_supplies\"", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "functions": [], + "unrendered_config": { + "enabled": "{{ var('load_source_data', false) }}", + "schema": "raw" + }, + "metrics": [], + "checksum": { + "name": "sha256", + "checksum": "f366329b7c2207ad5366b0bf8e495e1437606a31ddbeca4f9bbd2c434069880d" + }, + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "schema": "raw", + "enabled": true, + "grants": {}, + "post-hook": [], + "pre-hook": [], + "static_analysis": "strict", + "tags": [], + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "materialized": "seed" + }, + "root_path": "/project" + }, + "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8", + "database": "jaffle", + "schema": "main", + "name": "accepted_values_customers_customer_type__new__returning", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "accepted_values_customers_customer_type__new__returning" + ], + "path": "accepted_values_customers_customer_type__new__returning.sql", + "original_file_path": "models/marts/customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "accepted_values_customers_customer_type__new__returning", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/accepted_values_customers_customer_type__new__returning.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt.test_accepted_values" + ], + "nodes": [ + "model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.customers", + { + "line": 1, + "col": 79, + "index": 78, + "file": "generic_tests/accepted_values_customers_customer_type__new__returning.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n customer_type as value_field,\n count(*) as n_records\n\n from \"jaffle\".\"main\".\"customers\"\n group by customer_type\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'new','returning'\n)\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_type", + "attached_node": "model.jaffle_shop.customers", + "test_metadata": { + "name": "accepted_values", + "kwargs": { + "column_name": "customer_type", + "model": "{{ get_where_subquery(ref('customers')) }}", + "values": [ + "new", + "returning" + ] + } + }, + "file_key_name": "models.customers", + "generated_sql_file": "target/generic_tests/accepted_values_customers_customer_type__new__returning.sql" + }, + "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6", + "database": "jaffle", + "schema": "main", + "name": "dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend" + ], + "path": "dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565.sql", + "original_file_path": "models/marts/customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt_utils.test_expression_is_true" + ], + "nodes": [ + "model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.customers", + { + "line": 1, + "col": 136, + "index": 135, + "file": "generic_tests/dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ dbt_utils.test_expression_is_true(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565\") }}", + "compiled": true, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"customers\"\n\nwhere not(lifetime_spend_pretax + lifetime_tax_paid = lifetime_spend)\n\n", + "unrendered_config": { + "alias": "dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "attached_node": "model.jaffle_shop.customers", + "test_metadata": { + "name": "expression_is_true", + "kwargs": { + "expression": "lifetime_spend_pretax + lifetime_tax_paid = lifetime_spend", + "model": "{{ get_where_subquery(ref('customers')) }}" + }, + "namespace": "dbt_utils" + }, + "file_key_name": "models.customers", + "generated_sql_file": "target/generic_tests/dbt_utils_expression_is_true_c_177c20685a18a9071d4a71719e3d9565.sql" + }, + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec", + "database": "jaffle", + "schema": "main", + "name": "dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal" + ], + "path": "dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823.sql", + "original_file_path": "models/marts/orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt_utils.test_expression_is_true" + ], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 109, + "index": 108, + "file": "generic_tests/dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ dbt_utils.test_expression_is_true(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823\") }}", + "compiled": true, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"orders\"\n\nwhere not(order_items_subtotal = subtotal)\n\n", + "unrendered_config": { + "alias": "dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "attached_node": "model.jaffle_shop.orders", + "test_metadata": { + "name": "expression_is_true", + "kwargs": { + "expression": "order_items_subtotal = subtotal", + "model": "{{ get_where_subquery(ref('orders')) }}" + }, + "namespace": "dbt_utils" + }, + "file_key_name": "models.orders", + "generated_sql_file": "target/generic_tests/dbt_utils_expression_is_true_o_c0acd0b625f5605c61af04356663a823.sql" + }, + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92", + "database": "jaffle", + "schema": "main", + "name": "dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid" + ], + "path": "dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9.sql", + "original_file_path": "models/marts/orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt_utils.test_expression_is_true" + ], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 111, + "index": 110, + "file": "generic_tests/dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ dbt_utils.test_expression_is_true(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9\") }}", + "compiled": true, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"orders\"\n\nwhere not(order_total = subtotal + tax_paid)\n\n", + "unrendered_config": { + "alias": "dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "attached_node": "model.jaffle_shop.orders", + "test_metadata": { + "name": "expression_is_true", + "kwargs": { + "expression": "order_total = subtotal + tax_paid", + "model": "{{ get_where_subquery(ref('orders')) }}" + }, + "namespace": "dbt_utils" + }, + "file_key_name": "models.orders", + "generated_sql_file": "target/generic_tests/dbt_utils_expression_is_true_o_bf2cfee53d5bb32a0a918086ae35fff9.sql" + }, + "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc", + "database": "jaffle", + "schema": "main", + "name": "dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal" + ], + "path": "dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f.sql", + "original_file_path": "models/staging/stg_orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt_utils.test_expression_is_true" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_orders", + { + "line": 1, + "col": 111, + "index": 110, + "file": "generic_tests/dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ dbt_utils.test_expression_is_true(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f\") }}", + "compiled": true, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"stg_orders\"\n\nwhere not(order_total - tax_paid = subtotal)\n\n", + "unrendered_config": { + "alias": "dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "attached_node": "model.jaffle_shop.stg_orders", + "test_metadata": { + "name": "expression_is_true", + "kwargs": { + "expression": "order_total - tax_paid = subtotal", + "model": "{{ get_where_subquery(ref('stg_orders')) }}" + }, + "namespace": "dbt_utils" + }, + "file_key_name": "models.stg_orders", + "generated_sql_file": "target/generic_tests/dbt_utils_expression_is_true_s_fc9f3efa92425b23fb62ee5a96c17e3f.sql" + }, + "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d", + "database": "jaffle", + "schema": "main", + "name": "not_null_customers_customer_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "not_null_customers_customer_id" + ], + "path": "not_null_customers_customer_id.sql", + "original_file_path": "models/marts/customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_customers_customer_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_customers_customer_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.customers", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/not_null_customers_customer_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect customer_id\nfrom \"jaffle\".\"main\".\"customers\"\nwhere customer_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_id", + "attached_node": "model.jaffle_shop.customers", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "customer_id", + "model": "{{ get_where_subquery(ref('customers')) }}" + } + }, + "file_key_name": "models.customers", + "generated_sql_file": "target/generic_tests/not_null_customers_customer_id.sql" + }, + "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd", + "database": "jaffle", + "schema": "main", + "name": "not_null_order_items_order_item_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "not_null_order_items_order_item_id" + ], + "path": "not_null_order_items_order_item_id.sql", + "original_file_path": "models/marts/order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_order_items_order_item_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_order_items_order_item_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.order_items", + { + "line": 1, + "col": 72, + "index": 71, + "file": "generic_tests/not_null_order_items_order_item_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect order_item_id\nfrom \"jaffle\".\"main\".\"order_items\"\nwhere order_item_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_item_id", + "attached_node": "model.jaffle_shop.order_items", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_item_id", + "model": "{{ get_where_subquery(ref('order_items')) }}" + } + }, + "file_key_name": "models.order_items", + "generated_sql_file": "target/generic_tests/not_null_order_items_order_item_id.sql" + }, + "test.jaffle_shop.not_null_orders_order_id.cf6c17daed": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_orders_order_id.cf6c17daed", + "database": "jaffle", + "schema": "main", + "name": "not_null_orders_order_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "not_null_orders_order_id" + ], + "path": "not_null_orders_order_id.sql", + "original_file_path": "models/marts/orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_orders_order_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_orders_order_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 67, + "index": 66, + "file": "generic_tests/not_null_orders_order_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"orders\"\nwhere order_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.orders", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_id", + "model": "{{ get_where_subquery(ref('orders')) }}" + } + }, + "file_key_name": "models.orders", + "generated_sql_file": "target/generic_tests/not_null_orders_order_id.sql" + }, + "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_customers_customer_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_customers_customer_id" + ], + "path": "not_null_stg_customers_customer_id.sql", + "original_file_path": "models/staging/stg_customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_customers_customer_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_customers_customer_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_customers", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/not_null_stg_customers_customer_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect customer_id\nfrom \"jaffle\".\"main\".\"stg_customers\"\nwhere customer_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_id", + "attached_node": "model.jaffle_shop.stg_customers", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "customer_id", + "model": "{{ get_where_subquery(ref('stg_customers')) }}" + } + }, + "file_key_name": "models.stg_customers", + "generated_sql_file": "target/generic_tests/not_null_stg_customers_customer_id.sql" + }, + "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_locations_location_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_locations_location_id" + ], + "path": "not_null_stg_locations_location_id.sql", + "original_file_path": "models/staging/stg_locations.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_locations_location_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_locations_location_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_locations" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_locations", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/not_null_stg_locations_location_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_locations", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect location_id\nfrom \"jaffle\".\"main\".\"stg_locations\"\nwhere location_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "location_id", + "attached_node": "model.jaffle_shop.stg_locations", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "location_id", + "model": "{{ get_where_subquery(ref('stg_locations')) }}" + } + }, + "file_key_name": "models.stg_locations", + "generated_sql_file": "target/generic_tests/not_null_stg_locations_location_id.sql" + }, + "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_order_items_order_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_order_items_order_id" + ], + "path": "not_null_stg_order_items_order_id.sql", + "original_file_path": "models/staging/stg_order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_order_items_order_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_order_items_order_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_order_items", + { + "line": 1, + "col": 67, + "index": 66, + "file": "generic_tests/not_null_stg_order_items_order_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.stg_order_items", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_id", + "model": "{{ get_where_subquery(ref('stg_order_items')) }}" + } + }, + "file_key_name": "models.stg_order_items", + "generated_sql_file": "target/generic_tests/not_null_stg_order_items_order_id.sql" + }, + "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_order_items_order_item_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_order_items_order_item_id" + ], + "path": "not_null_stg_order_items_order_item_id.sql", + "original_file_path": "models/staging/stg_order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_order_items_order_item_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_order_items_order_item_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_order_items", + { + "line": 1, + "col": 72, + "index": 71, + "file": "generic_tests/not_null_stg_order_items_order_item_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect order_item_id\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_item_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_item_id", + "attached_node": "model.jaffle_shop.stg_order_items", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_item_id", + "model": "{{ get_where_subquery(ref('stg_order_items')) }}" + } + }, + "file_key_name": "models.stg_order_items", + "generated_sql_file": "target/generic_tests/not_null_stg_order_items_order_item_id.sql" + }, + "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_orders_order_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_orders_order_id" + ], + "path": "not_null_stg_orders_order_id.sql", + "original_file_path": "models/staging/stg_orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_orders_order_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_orders_order_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_orders", + { + "line": 1, + "col": 67, + "index": 66, + "file": "generic_tests/not_null_stg_orders_order_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"stg_orders\"\nwhere order_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.stg_orders", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_id", + "model": "{{ get_where_subquery(ref('stg_orders')) }}" + } + }, + "file_key_name": "models.stg_orders", + "generated_sql_file": "target/generic_tests/not_null_stg_orders_order_id.sql" + }, + "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_products_product_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_products_product_id" + ], + "path": "not_null_stg_products_product_id.sql", + "original_file_path": "models/staging/stg_products.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_products_product_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_products_product_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_products" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_products", + { + "line": 1, + "col": 69, + "index": 68, + "file": "generic_tests/not_null_stg_products_product_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_products", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect product_id\nfrom \"jaffle\".\"main\".\"stg_products\"\nwhere product_id is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "product_id", + "attached_node": "model.jaffle_shop.stg_products", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "product_id", + "model": "{{ get_where_subquery(ref('stg_products')) }}" + } + }, + "file_key_name": "models.stg_products", + "generated_sql_file": "target/generic_tests/not_null_stg_products_product_id.sql" + }, + "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d", + "database": "jaffle", + "schema": "main", + "name": "not_null_stg_supplies_supply_uuid", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "not_null_stg_supplies_supply_uuid" + ], + "path": "not_null_stg_supplies_supply_uuid.sql", + "original_file_path": "models/staging/stg_supplies.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "not_null_stg_supplies_supply_uuid", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/not_null_stg_supplies_supply_uuid.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_supplies" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_supplies", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/not_null_stg_supplies_supply_uuid.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_supplies", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\n\n\nselect supply_uuid\nfrom \"jaffle\".\"main\".\"stg_supplies\"\nwhere supply_uuid is null\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "supply_uuid", + "attached_node": "model.jaffle_shop.stg_supplies", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "supply_uuid", + "model": "{{ get_where_subquery(ref('stg_supplies')) }}" + } + }, + "file_key_name": "models.stg_supplies", + "generated_sql_file": "target/generic_tests/not_null_stg_supplies_supply_uuid.sql" + }, + "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8", + "database": "jaffle", + "schema": "main", + "name": "relationships_order_items_order_id__order_id__ref_orders_", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "relationships_order_items_order_id__order_id__ref_orders_" + ], + "path": "relationships_order_items_order_id__order_id__ref_orders_.sql", + "original_file_path": "models/marts/order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "relationships_order_items_order_id__order_id__ref_orders_", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/relationships_order_items_order_id__order_id__ref_orders_.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt.test_relationships" + ], + "nodes": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.order_items", + { + "line": 1, + "col": 90, + "index": 89, + "file": "generic_tests/relationships_order_items_order_id__order_id__ref_orders_.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 114, + "index": 113, + "file": "generic_tests/relationships_order_items_order_id__order_id__ref_orders_.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "order_items", + "package": null, + "version": null + }, + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_relationships(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nwith child as (\n select order_id as from_field\n from \"jaffle\".\"main\".\"order_items\"\n where order_id is not null\n),\n\nparent as (\n select order_id as to_field\n from \"jaffle\".\"main\".\"orders\"\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\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.order_items", + "test_metadata": { + "name": "relationships", + "kwargs": { + "column_name": "order_id", + "field": "order_id", + "model": "{{ get_where_subquery(ref('order_items')) }}", + "to": "ref('orders')" + } + }, + "file_key_name": "models.order_items", + "generated_sql_file": "target/generic_tests/relationships_order_items_order_id__order_id__ref_orders_.sql" + }, + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16", + "database": "jaffle", + "schema": "main", + "name": "relationships_orders_customer_id__customer_id__ref_stg_customers_", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "relationships_orders_customer_id__customer_id__ref_stg_customers_" + ], + "path": "relationships_orders_0389c224a99a98c0b58aedb753f052f0.sql", + "original_file_path": "models/marts/orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "relationships_orders_0389c224a99a98c0b58aedb753f052f0", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/relationships_orders_0389c224a99a98c0b58aedb753f052f0.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt.test_relationships" + ], + "nodes": [ + "model.jaffle_shop.orders", + "model.jaffle_shop.stg_customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 96, + "index": 95, + "file": "generic_tests/relationships_orders_0389c224a99a98c0b58aedb753f052f0.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.stg_customers", + { + "line": 1, + "col": 115, + "index": 114, + "file": "generic_tests/relationships_orders_0389c224a99a98c0b58aedb753f052f0.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + }, + { + "name": "stg_customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_relationships(**_dbt_generic_test_kwargs) }}{{ config(alias=\"relationships_orders_0389c224a99a98c0b58aedb753f052f0\") }}", + "compiled": true, + "compiled_code": "\n \n \n\nwith child as (\n select customer_id as from_field\n from \"jaffle\".\"main\".\"orders\"\n where customer_id is not null\n),\n\nparent as (\n select customer_id as to_field\n from \"jaffle\".\"main\".\"stg_customers\"\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\n", + "unrendered_config": { + "alias": "relationships_orders_0389c224a99a98c0b58aedb753f052f0" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "relationships_orders_0389c224a99a98c0b58aedb753f052f0", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_id", + "attached_node": "model.jaffle_shop.orders", + "test_metadata": { + "name": "relationships", + "kwargs": { + "column_name": "customer_id", + "field": "customer_id", + "model": "{{ get_where_subquery(ref('orders')) }}", + "to": "ref('stg_customers')" + } + }, + "file_key_name": "models.orders", + "generated_sql_file": "target/generic_tests/relationships_orders_0389c224a99a98c0b58aedb753f052f0.sql" + }, + "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54", + "database": "jaffle", + "schema": "main", + "name": "relationships_stg_order_items_order_id__order_id__ref_stg_orders_", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "relationships_stg_order_items_order_id__order_id__ref_stg_orders_" + ], + "path": "relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0.sql", + "original_file_path": "models/staging/stg_order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.get_where_subquery", + "macro.dbt.test_relationships" + ], + "nodes": [ + "model.jaffle_shop.stg_order_items", + "model.jaffle_shop.stg_orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_order_items", + { + "line": 1, + "col": 90, + "index": 89, + "file": "generic_tests/relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0.sql", + "expanded": null + } + ], + [ + "model.jaffle_shop.stg_orders", + { + "line": 1, + "col": 118, + "index": 117, + "file": "generic_tests/relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_order_items", + "package": null, + "version": null + }, + { + "name": "stg_orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_relationships(**_dbt_generic_test_kwargs) }}{{ config(alias=\"relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0\") }}", + "compiled": true, + "compiled_code": "\n \n \n\nwith child as (\n select order_id as from_field\n from \"jaffle\".\"main\".\"stg_order_items\"\n where order_id is not null\n),\n\nparent as (\n select order_id as to_field\n from \"jaffle\".\"main\".\"stg_orders\"\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\n", + "unrendered_config": { + "alias": "relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0" + }, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": "relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0", + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.stg_order_items", + "test_metadata": { + "name": "relationships", + "kwargs": { + "column_name": "order_id", + "field": "order_id", + "model": "{{ get_where_subquery(ref('stg_order_items')) }}", + "to": "ref('stg_orders')" + } + }, + "file_key_name": "models.stg_order_items", + "generated_sql_file": "target/generic_tests/relationships_stg_order_items_b3d7cdbd08ebfad01e3226c01c10bba0.sql" + }, + "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1", + "database": "jaffle", + "schema": "main", + "name": "unique_customers_customer_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "unique_customers_customer_id" + ], + "path": "unique_customers_customer_id.sql", + "original_file_path": "models/marts/customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_customers_customer_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_customers_customer_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.customers", + { + "line": 1, + "col": 68, + "index": 67, + "file": "generic_tests/unique_customers_customer_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"customers\"\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_id", + "attached_node": "model.jaffle_shop.customers", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "customer_id", + "model": "{{ get_where_subquery(ref('customers')) }}" + } + }, + "file_key_name": "models.customers", + "generated_sql_file": "target/generic_tests/unique_customers_customer_id.sql" + }, + "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a", + "database": "jaffle", + "schema": "main", + "name": "unique_order_items_order_item_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "unique_order_items_order_item_id" + ], + "path": "unique_order_items_order_item_id.sql", + "original_file_path": "models/marts/order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_order_items_order_item_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_order_items_order_item_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.order_items", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/unique_order_items_order_item_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"order_items\"\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_item_id", + "attached_node": "model.jaffle_shop.order_items", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_item_id", + "model": "{{ get_where_subquery(ref('order_items')) }}" + } + }, + "file_key_name": "models.order_items", + "generated_sql_file": "target/generic_tests/unique_order_items_order_item_id.sql" + }, + "test.jaffle_shop.unique_orders_order_id.fed79b3a6e": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_orders_order_id.fed79b3a6e", + "database": "jaffle", + "schema": "main", + "name": "unique_orders_order_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "unique_orders_order_id" + ], + "path": "unique_orders_order_id.sql", + "original_file_path": "models/marts/orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_orders_order_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_orders_order_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 1, + "col": 65, + "index": 64, + "file": "generic_tests/unique_orders_order_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"orders\"\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.orders", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_id", + "model": "{{ get_where_subquery(ref('orders')) }}" + } + }, + "file_key_name": "models.orders", + "generated_sql_file": "target/generic_tests/unique_orders_order_id.sql" + }, + "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_customers_customer_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_customers_customer_id" + ], + "path": "unique_stg_customers_customer_id.sql", + "original_file_path": "models/staging/stg_customers.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_customers_customer_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_customers_customer_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_customers", + { + "line": 1, + "col": 68, + "index": 67, + "file": "generic_tests/unique_stg_customers_customer_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_customers", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_customers\"\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "customer_id", + "attached_node": "model.jaffle_shop.stg_customers", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "customer_id", + "model": "{{ get_where_subquery(ref('stg_customers')) }}" + } + }, + "file_key_name": "models.stg_customers", + "generated_sql_file": "target/generic_tests/unique_stg_customers_customer_id.sql" + }, + "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_locations_location_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_locations_location_id" + ], + "path": "unique_stg_locations_location_id.sql", + "original_file_path": "models/staging/stg_locations.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_locations_location_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_locations_location_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_locations" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_locations", + { + "line": 1, + "col": 68, + "index": 67, + "file": "generic_tests/unique_stg_locations_location_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_locations", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_locations\"\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "location_id", + "attached_node": "model.jaffle_shop.stg_locations", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "location_id", + "model": "{{ get_where_subquery(ref('stg_locations')) }}" + } + }, + "file_key_name": "models.stg_locations", + "generated_sql_file": "target/generic_tests/unique_stg_locations_location_id.sql" + }, + "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_order_items_order_item_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_order_items_order_item_id" + ], + "path": "unique_stg_order_items_order_item_id.sql", + "original_file_path": "models/staging/stg_order_items.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_order_items_order_item_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_order_items_order_item_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_order_items", + { + "line": 1, + "col": 70, + "index": 69, + "file": "generic_tests/unique_stg_order_items_order_item_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_order_items", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_item_id", + "attached_node": "model.jaffle_shop.stg_order_items", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_item_id", + "model": "{{ get_where_subquery(ref('stg_order_items')) }}" + } + }, + "file_key_name": "models.stg_order_items", + "generated_sql_file": "target/generic_tests/unique_stg_order_items_order_item_id.sql" + }, + "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_orders_order_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_orders_order_id" + ], + "path": "unique_stg_orders_order_id.sql", + "original_file_path": "models/staging/stg_orders.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_orders_order_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_orders_order_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_orders", + { + "line": 1, + "col": 65, + "index": 64, + "file": "generic_tests/unique_stg_orders_order_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_orders", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_orders\"\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "order_id", + "attached_node": "model.jaffle_shop.stg_orders", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_id", + "model": "{{ get_where_subquery(ref('stg_orders')) }}" + } + }, + "file_key_name": "models.stg_orders", + "generated_sql_file": "target/generic_tests/unique_stg_orders_order_id.sql" + }, + "test.jaffle_shop.unique_stg_products_product_id.7d950a1467": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_products_product_id.7d950a1467", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_products_product_id", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_products_product_id" + ], + "path": "unique_stg_products_product_id.sql", + "original_file_path": "models/staging/stg_products.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_products_product_id", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_products_product_id.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_products" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_products", + { + "line": 1, + "col": 67, + "index": 66, + "file": "generic_tests/unique_stg_products_product_id.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_products", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n product_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_products\"\nwhere product_id is not null\ngroup by product_id\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "product_id", + "attached_node": "model.jaffle_shop.stg_products", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "product_id", + "model": "{{ get_where_subquery(ref('stg_products')) }}" + } + }, + "file_key_name": "models.stg_products", + "generated_sql_file": "target/generic_tests/unique_stg_products_product_id.sql" + }, + "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed": { + "resource_type": "test", + "unique_id": "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed", + "database": "jaffle", + "schema": "main", + "name": "unique_stg_supplies_supply_uuid", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "unique_stg_supplies_supply_uuid" + ], + "path": "unique_stg_supplies_supply_uuid.sql", + "original_file_path": "models/staging/stg_supplies.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "unique_stg_supplies_supply_uuid", + "compiled_path": "target/compiled/jaffle_shop/target/generic_tests/unique_stg_supplies_supply_uuid.sql", + "columns": {}, + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_supplies" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_supplies", + { + "line": 1, + "col": 68, + "index": 67, + "file": "generic_tests/unique_stg_supplies_supply_uuid.sql", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_supplies", + "package": null, + "version": null + } + ], + "sources": [], + "functions": [], + "raw_code": "{{ test_unique(**_dbt_generic_test_kwargs) }}", + "compiled": true, + "compiled_code": "\n \n \n\nselect\n supply_uuid as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_supplies\"\nwhere supply_uuid is not null\ngroup by supply_uuid\nhaving count(*) > 1\n\n\n", + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "alias": null, + "compute": null, + "database": null, + "schema": "dbt_test__audit", + "enabled": true, + "error_if": "!= 0", + "fail_calc": "count(*)", + "full_refresh": null, + "group": null, + "limit": null, + "meta": {}, + "severity": "ERROR", + "store_failures": null, + "store_failures_as": null, + "sql_header": null, + "tags": [], + "warn_if": "!= 0", + "quoting": { + "database": true, + "identifier": true, + "schema": true, + "snowflake_ignore_case": false + }, + "static_analysis": "strict", + "where": null, + "materialized": "test" + }, + "column_name": "supply_uuid", + "attached_node": "model.jaffle_shop.stg_supplies", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "supply_uuid", + "model": "{{ get_where_subquery(ref('stg_supplies')) }}" + } + }, + "file_key_name": "models.stg_supplies", + "generated_sql_file": "target/generic_tests/unique_stg_supplies_supply_uuid.sql" + } + }, + "sources": { + "source.jaffle_shop.ecom.raw_customers": { + "unique_id": "source.jaffle_shop.ecom.raw_customers", + "database": "jaffle", + "schema": "raw", + "name": "raw_customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_customers" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "One record per person who has purchased one or more items", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_customers\"", + "identifier": "raw_customers", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": null, + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": null, + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + }, + "source.jaffle_shop.ecom.raw_items": { + "unique_id": "source.jaffle_shop.ecom.raw_items", + "database": "jaffle", + "schema": "raw", + "name": "raw_items", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_items" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "Items included in an order", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_items\"", + "identifier": "raw_items", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": null, + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": null, + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + }, + "source.jaffle_shop.ecom.raw_orders": { + "unique_id": "source.jaffle_shop.ecom.raw_orders", + "database": "jaffle", + "schema": "raw", + "name": "raw_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_orders" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "One record per order (consisting of one or more order items)", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_orders\"", + "identifier": "raw_orders", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": "ordered_at", + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": "ordered_at", + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "loaded_at_field": "ordered_at", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + }, + "source.jaffle_shop.ecom.raw_products": { + "unique_id": "source.jaffle_shop.ecom.raw_products", + "database": "jaffle", + "schema": "raw", + "name": "raw_products", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_products" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "One record per SKU for items sold in stores", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_products\"", + "identifier": "raw_products", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": null, + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": null, + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + }, + "source.jaffle_shop.ecom.raw_stores": { + "unique_id": "source.jaffle_shop.ecom.raw_stores", + "database": "jaffle", + "schema": "raw", + "name": "raw_stores", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_stores" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_stores\"", + "identifier": "raw_stores", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": "opened_at", + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": "opened_at", + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "loaded_at_field": "opened_at", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + }, + "source.jaffle_shop.ecom.raw_supplies": { + "unique_id": "source.jaffle_shop.ecom.raw_supplies", + "database": "jaffle", + "schema": "raw", + "name": "raw_supplies", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "ecom", + "raw_supplies" + ], + "path": "models/staging/__sources.yml", + "original_file_path": "models/staging/__sources.yml", + "description": "One record per supply per SKU of items sold in stores", + "tags": [], + "classifiers": [], + "meta": {}, + "relation_name": "\"jaffle\".\"raw\".\"raw_supplies\"", + "identifier": "raw_supplies", + "source_name": "ecom", + "columns": {}, + "config": { + "enabled": true, + "event_time": null, + "meta": {}, + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "tags": [], + "loaded_at_field": null, + "loaded_at_query": null, + "static_analysis": "strict", + "schema_origin": "remote" + }, + "source_description": "E-commerce data for the Jaffle Shop", + "unrendered_config": { + "loaded_at_field": null, + "loaded_at_query": null, + "meta": {}, + "tags": [] + }, + "unrendered_schema": "raw", + "loader": "", + "freshness": { + "error_after": { + "count": null, + "period": null + }, + "warn_after": { + "count": null, + "period": null + } + }, + "external": null, + "resource_type": "source" + } + }, + "macros": { + "macro.audit_helper._classify_audit_row_status": { + "name": "_classify_audit_row_status", + "package_name": "audit_helper", + "path": "macros/utils/_classify_audit_row_status.sql", + "original_file_path": "macros/utils/_classify_audit_row_status.sql", + "unique_id": "macro.audit_helper._classify_audit_row_status", + "macro_sql": "{% macro _classify_audit_row_status() %}\n {{ return(adapter.dispatch('_classify_audit_row_status', 'audit_helper')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default___classify_audit_row_status" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._count_num_rows_in_status": { + "name": "_count_num_rows_in_status", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper._count_num_rows_in_status", + "macro_sql": "{% macro _count_num_rows_in_status() %}\n {{ return(adapter.dispatch('_count_num_rows_in_status', 'audit_helper')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default___count_num_rows_in_status" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._count_num_rows_in_status_without_distinct_window_func": { + "name": "_count_num_rows_in_status_without_distinct_window_func", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper._count_num_rows_in_status_without_distinct_window_func", + "macro_sql": "{% macro _count_num_rows_in_status_without_distinct_window_func() %}\n {#- Some platforms don't support count(distinct) inside of window functions -#}\n {#- You can get the same outcome by dense_rank, assuming no nulls (we've already handled that) #}\n {# https://stackoverflow.com/a/22347502 -#}\n dense_rank() over (partition by dbt_audit_row_status order by dbt_audit_surrogate_key, dbt_audit_pk_row_num)\n + dense_rank() over (partition by dbt_audit_row_status order by dbt_audit_surrogate_key desc, dbt_audit_pk_row_num desc)\n - 1\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._ensure_all_pks_are_in_column_set": { + "name": "_ensure_all_pks_are_in_column_set", + "package_name": "audit_helper", + "path": "macros/utils/_ensure_all_pks_are_in_column_set.sql", + "original_file_path": "macros/utils/_ensure_all_pks_are_in_column_set.sql", + "unique_id": "macro.audit_helper._ensure_all_pks_are_in_column_set", + "macro_sql": "{% macro _ensure_all_pks_are_in_column_set(primary_key_columns, columns) %}\n {% set lower_cols = columns | map('lower') | list %}\n {% set missing_pks = [] %}\n\n {% for pk in primary_key_columns %}\n {% if pk | lower not in lower_cols %}\n {% do missing_pks.append(pk) %}\n {% endif %}\n {% endfor %}\n\n {% if missing_pks | length > 0 %}\n {% set columns = missing_pks + columns %}\n {% endif %}\n \n {% do return (columns) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._generate_null_safe_surrogate_key": { + "name": "_generate_null_safe_surrogate_key", + "package_name": "audit_helper", + "path": "macros/utils/_generate_null_safe_sk.sql", + "original_file_path": "macros/utils/_generate_null_safe_sk.sql", + "unique_id": "macro.audit_helper._generate_null_safe_surrogate_key", + "macro_sql": "{%- macro _generate_null_safe_surrogate_key(field_list) -%}\n {{ return(adapter.dispatch('_generate_null_safe_surrogate_key', 'audit_helper')(field_list)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default___generate_null_safe_surrogate_key" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._generate_set_results": { + "name": "_generate_set_results", + "package_name": "audit_helper", + "path": "macros/utils/_generate_set_results.sql", + "original_file_path": "macros/utils/_generate_set_results.sql", + "unique_id": "macro.audit_helper._generate_set_results", + "macro_sql": "{% macro _generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props=None) %}\n {{ return(adapter.dispatch('_generate_set_results', 'audit_helper')(a_query, b_query, primary_key_columns, columns, event_time_props)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default___generate_set_results" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._get_comparison_bounds": { + "name": "_get_comparison_bounds", + "package_name": "audit_helper", + "path": "macros/utils/_get_comparison_bounds.sql", + "original_file_path": "macros/utils/_get_comparison_bounds.sql", + "unique_id": "macro.audit_helper._get_comparison_bounds", + "macro_sql": "{% macro _get_comparison_bounds(a_query, b_query, event_time) %}\n {% set min_max_queries %}\n with min_maxes as (\n select min({{ event_time }}) as min_event_time, max({{ event_time }}) as max_event_time\n from ({{ a_query }}) a_subq\n union all \n select min({{ event_time }}) as min_event_time, max({{ event_time }}) as max_event_time\n from ({{ b_query }}) b_subq\n )\n select max(min_event_time) as min_event_time, min(max_event_time) as max_event_time\n from min_maxes\n {% endset %}\n\n {% set query_response = dbt_utils.get_query_results_as_dict(min_max_queries) %}\n \n {% set event_time_props = {\"event_time\": event_time} %}\n \n {# query_response.keys() are only `min_event_time` and `max_event_time`, but they have indeterminate capitalisation #}\n {# hence the dynamic approach for what is otherwise just two well-known values #}\n {% for k in query_response.keys() %}\n {% do event_time_props.update({k | lower: query_response[k][0]}) %}\n {% endfor %}\n \n {% do return(event_time_props) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_query_results_as_dict" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper._get_intersecting_columns_from_relations": { + "name": "_get_intersecting_columns_from_relations", + "package_name": "audit_helper", + "path": "macros/utils/_get_intersecting_columns_from_relations.sql", + "original_file_path": "macros/utils/_get_intersecting_columns_from_relations.sql", + "unique_id": "macro.audit_helper._get_intersecting_columns_from_relations", + "macro_sql": "{% macro _get_intersecting_columns_from_relations(a_relation, b_relation) %} \n {%- set a_cols = dbt_utils.get_filtered_columns_in_relation(a_relation) -%}\n {%- set b_cols = dbt_utils.get_filtered_columns_in_relation(b_relation) -%}\n \n {%- set intersection = [] -%}\n {%- for col in a_cols -%}\n {%- if col in b_cols -%}\n {%- do intersection.append(col) -%}\n {%- endif -%}\n {%- endfor -%}\n\n {% do return(intersection) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_filtered_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.bigquery___count_num_rows_in_status": { + "name": "bigquery___count_num_rows_in_status", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper.bigquery___count_num_rows_in_status", + "macro_sql": "{%- macro bigquery___count_num_rows_in_status() -%}\n count(distinct {{ dbt.concat([\"dbt_audit_surrogate_key\", \"dbt_audit_pk_row_num\"]) }}) over (partition by dbt_audit_row_status)\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.concat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.bigquery___generate_set_results": { + "name": "bigquery___generate_set_results", + "package_name": "audit_helper", + "path": "macros/utils/_generate_set_results.sql", + "original_file_path": "macros/utils/_generate_set_results.sql", + "unique_id": "macro.audit_helper.bigquery___generate_set_results", + "macro_sql": "{% macro bigquery___generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props) %}\n {% set joined_cols = columns | join(\", \") %}\n {% set surrogate_key = audit_helper._generate_null_safe_surrogate_key(primary_key_columns) %}\n subset_columns_a as (\n select \n {{ joined_cols }}, \n {{ surrogate_key }} as dbt_audit_surrogate_key,\n row_number() over (partition by {{ surrogate_key }} order by 1 ) as dbt_audit_pk_row_num\n from ( {{- a_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n subset_columns_b as (\n select \n {{ joined_cols }}, \n {{ surrogate_key }} as dbt_audit_surrogate_key,\n row_number() over (partition by {{ surrogate_key }} order by 1 ) as dbt_audit_pk_row_num\n from ( {{- b_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n a as (\n select\n *,\n farm_fingerprint(to_json_string(subset_columns_a)) as dbt_audit_row_hash\n from subset_columns_a\n ), \n\n b as (\n select\n *,\n farm_fingerprint(to_json_string(subset_columns_b)) as dbt_audit_row_hash\n from subset_columns_b\n ),\n\n a_intersect_b as (\n\n select * from a\n where a.dbt_audit_row_hash in (select b.dbt_audit_row_hash from b)\n\n ),\n\n a_except_b as (\n\n select * from a\n where a.dbt_audit_row_hash not in (select b.dbt_audit_row_hash from b)\n\n ),\n\n b_except_a as (\n\n select * from b\n where b.dbt_audit_row_hash not in (select a.dbt_audit_row_hash from a)\n\n )\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._generate_null_safe_surrogate_key", + "macro.audit_helper.event_time_filter" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.bigquery__get_columns_in_relation_sql": { + "name": "bigquery__get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.bigquery__get_columns_in_relation_sql", + "macro_sql": "{% macro bigquery__get_columns_in_relation_sql(relation) %}\n\n select\n ordinal_position,\n column_name,\n data_type\n\n from `{{ relation.database }}`.`{{ relation.schema }}`.INFORMATION_SCHEMA.COLUMNS\n where table_name = '{{ relation.identifier }}'\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.bigquery__quick_are_queries_identical": { + "name": "bigquery__quick_are_queries_identical", + "package_name": "audit_helper", + "path": "macros/quick_are_queries_identical.sql", + "original_file_path": "macros/quick_are_queries_identical.sql", + "unique_id": "macro.audit_helper.bigquery__quick_are_queries_identical", + "macro_sql": "{% macro bigquery__quick_are_queries_identical(query_a, query_b, columns, event_time) %}\n {% set joined_cols = columns | join(\", \") %}\n {% if event_time %}\n {% set event_time_props = audit_helper._get_comparison_bounds(a_query, b_query, event_time) %}\n {% endif %}\n\n with query_a as (\n select {{ joined_cols }}\n from ({{ query_a }})\n {{ audit_helper.event_time_filter(event_time_props) }}\n ), \n query_b as (\n select {{ joined_cols }}\n from ({{ query_b }})\n {{ audit_helper.event_time_filter(event_time_props) }}\n )\n\n select count(distinct IFNULL(hash_result,0)) = 1 as are_tables_identical\n from (\n select bit_xor(farm_fingerprint(to_json_string(query_a))) as hash_result\n from query_a\n\n union all\n \n select bit_xor(farm_fingerprint(to_json_string(query_b))) as hash_result\n from query_b\n ) as hashes\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._get_comparison_bounds", + "macro.audit_helper.event_time_filter" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_all_columns": { + "name": "compare_all_columns", + "package_name": "audit_helper", + "path": "macros/compare_all_columns.sql", + "original_file_path": "macros/compare_all_columns.sql", + "unique_id": "macro.audit_helper.compare_all_columns", + "macro_sql": "{% macro compare_all_columns( a_relation, b_relation, primary_key, exclude_columns=[],summarize=true ) -%}\n {{ return(adapter.dispatch('compare_all_columns', 'audit_helper')( a_relation, b_relation, primary_key, exclude_columns, summarize )) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_all_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_and_classify_query_results": { + "name": "compare_and_classify_query_results", + "package_name": "audit_helper", + "path": "macros/compare_and_classify_query_results.sql", + "original_file_path": "macros/compare_and_classify_query_results.sql", + "unique_id": "macro.audit_helper.compare_and_classify_query_results", + "macro_sql": "{% macro compare_and_classify_query_results(a_query, b_query, primary_key_columns=[], columns=[], event_time=None, sample_limit=20) %}\n {{ return(adapter.dispatch('compare_and_classify_query_results', 'audit_helper')(a_query, b_query, primary_key_columns, columns, event_time, sample_limit)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_and_classify_query_results" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_and_classify_relation_rows": { + "name": "compare_and_classify_relation_rows", + "package_name": "audit_helper", + "path": "macros/compare_and_classify_relation_rows.sql", + "original_file_path": "macros/compare_and_classify_relation_rows.sql", + "unique_id": "macro.audit_helper.compare_and_classify_relation_rows", + "macro_sql": "{% macro compare_and_classify_relation_rows(a_relation, b_relation, primary_key_columns=[], columns=None, event_time=None, sample_limit=20) %}\n {%- if not columns -%}\n {%- set columns = audit_helper._get_intersecting_columns_from_relations(a_relation, b_relation) -%}\n {%- endif -%}\n\n {{ \n audit_helper.compare_and_classify_query_results(\n \"select * from \" ~ a_relation,\n \"select * from \" ~ b_relation,\n primary_key_columns,\n columns,\n event_time,\n sample_limit\n )\n }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._get_intersecting_columns_from_relations", + "macro.audit_helper.compare_and_classify_query_results" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_column_values": { + "name": "compare_column_values", + "package_name": "audit_helper", + "path": "macros/compare_column_values.sql", + "original_file_path": "macros/compare_column_values.sql", + "unique_id": "macro.audit_helper.compare_column_values", + "macro_sql": "{% macro compare_column_values(a_query, b_query, primary_key, column_to_compare, emojis=True, a_relation_name='a', b_relation_name='b') -%}\n {{ return(adapter.dispatch('compare_column_values', 'audit_helper')(a_query, b_query, primary_key, column_to_compare, emojis, a_relation_name, b_relation_name)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_column_values" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_column_values_verbose": { + "name": "compare_column_values_verbose", + "package_name": "audit_helper", + "path": "macros/compare_column_values_verbose.sql", + "original_file_path": "macros/compare_column_values_verbose.sql", + "unique_id": "macro.audit_helper.compare_column_values_verbose", + "macro_sql": "{% macro compare_column_values_verbose(a_query, b_query, primary_key, column_to_compare) -%}\n {{ return(adapter.dispatch('compare_column_values_verbose', 'audit_helper')(a_query, b_query, primary_key, column_to_compare)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_column_values_verbose" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_queries": { + "name": "compare_queries", + "package_name": "audit_helper", + "path": "macros/compare_queries.sql", + "original_file_path": "macros/compare_queries.sql", + "unique_id": "macro.audit_helper.compare_queries", + "macro_sql": "{% macro compare_queries(a_query, b_query, primary_key=None, summarize=true, limit=None) -%}\n {{ return(adapter.dispatch('compare_queries', 'audit_helper')(a_query, b_query, primary_key, summarize, limit)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_queries" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_relation_columns": { + "name": "compare_relation_columns", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.compare_relation_columns", + "macro_sql": "{% macro compare_relation_columns(a_relation, b_relation) %}\n {{ return(adapter.dispatch('compare_relation_columns', 'audit_helper')(a_relation, b_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_relation_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_relations": { + "name": "compare_relations", + "package_name": "audit_helper", + "path": "macros/compare_relations.sql", + "original_file_path": "macros/compare_relations.sql", + "unique_id": "macro.audit_helper.compare_relations", + "macro_sql": "{% macro compare_relations(a_relation, b_relation, exclude_columns=[], primary_key=None, summarize=true, limit=None) %}\n\n{% set column_names = dbt_utils.get_filtered_columns_in_relation(from=a_relation, except=exclude_columns) %}\n\n{% set column_selection %}\n\n {% for column_name in column_names %} \n {{ adapter.quote(column_name) }} \n {% if not loop.last %}\n , \n {% endif %} \n {% endfor %}\n\n{% endset %}\n\n{% set a_query %}\nselect\n\n {{ column_selection }}\n\nfrom {{ a_relation }}\n{% endset %}\n\n{% set b_query %}\nselect\n\n {{ column_selection }}\n\nfrom {{ b_relation }}\n{% endset %}\n\n{{ audit_helper.compare_queries(a_query, b_query, primary_key, summarize, limit) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.compare_queries", + "macro.dbt_utils.get_filtered_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_row_counts": { + "name": "compare_row_counts", + "package_name": "audit_helper", + "path": "macros/compare_row_counts.sql", + "original_file_path": "macros/compare_row_counts.sql", + "unique_id": "macro.audit_helper.compare_row_counts", + "macro_sql": "{% macro compare_row_counts(a_relation, b_relation) %}\n {{ return(adapter.dispatch('compare_row_counts', 'audit_helper')(a_relation, b_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_row_counts" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_which_query_columns_differ": { + "name": "compare_which_query_columns_differ", + "package_name": "audit_helper", + "path": "macros/compare_which_query_columns_differ.sql", + "original_file_path": "macros/compare_which_query_columns_differ.sql", + "unique_id": "macro.audit_helper.compare_which_query_columns_differ", + "macro_sql": "{% macro compare_which_query_columns_differ(a_query, b_query, primary_key_columns=[], columns=[], event_time=None) %}\n {{ return(adapter.dispatch('compare_which_query_columns_differ', 'audit_helper')(a_query, b_query, primary_key_columns, columns, event_time)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__compare_which_query_columns_differ" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.compare_which_relation_columns_differ": { + "name": "compare_which_relation_columns_differ", + "package_name": "audit_helper", + "path": "macros/compare_which_relation_columns_differ.sql", + "original_file_path": "macros/compare_which_relation_columns_differ.sql", + "unique_id": "macro.audit_helper.compare_which_relation_columns_differ", + "macro_sql": "{% macro compare_which_relation_columns_differ(a_relation, b_relation, primary_key_columns=[], columns=[], event_time=None) %}\n {%- if not columns -%}\n {%- set columns = audit_helper._get_intersecting_columns_from_relations(a_relation, b_relation) -%}\n {%- endif -%}\n\n {{ \n audit_helper.compare_which_query_columns_differ(\n \"select * from \" ~ a_relation,\n \"select * from \" ~ b_relation,\n primary_key_columns,\n columns,\n event_time\n )\n }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._get_intersecting_columns_from_relations", + "macro.audit_helper.compare_which_query_columns_differ" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.databricks___count_num_rows_in_status": { + "name": "databricks___count_num_rows_in_status", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper.databricks___count_num_rows_in_status", + "macro_sql": "{%- macro databricks___count_num_rows_in_status() -%}\n {{ audit_helper._count_num_rows_in_status_without_distinct_window_func() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._count_num_rows_in_status_without_distinct_window_func" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.databricks___generate_set_results": { + "name": "databricks___generate_set_results", + "package_name": "audit_helper", + "path": "macros/utils/_generate_set_results.sql", + "original_file_path": "macros/utils/_generate_set_results.sql", + "unique_id": "macro.audit_helper.databricks___generate_set_results", + "macro_sql": "{% macro databricks___generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props) %}\n {% set cast_columns = [] %}\n {# Map types can't be compared by default (you need to opt in to a legacy behaviour flag) #}\n {# so everything needs to be cast as a string first :( #}\n {% for col in columns %}\n {% do cast_columns.append(dbt.cast(col, api.Column.translate_type(\"string\"))) %}\n {% endfor %}\n {% set joined_cols = cast_columns | join(\", \") %}\n {% set surrogate_key = audit_helper._generate_null_safe_surrogate_key(primary_key_columns) %}\n a as (\n select \n {{ joined_cols }}, \n {{ surrogate_key }} as dbt_audit_surrogate_key,\n row_number() over (partition by {{ surrogate_key }} order by 1 ) as dbt_audit_pk_row_num,\n xxhash64({{ joined_cols }}, dbt_audit_pk_row_num) as dbt_audit_row_hash\n from ( {{- a_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n b as (\n select \n {{ joined_cols }}, \n {{ surrogate_key }} as dbt_audit_surrogate_key,\n row_number() over (partition by {{ surrogate_key }} order by 1 ) as dbt_audit_pk_row_num,\n xxhash64({{ joined_cols }}, dbt_audit_pk_row_num) as dbt_audit_row_hash\n from ( {{- b_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n a_intersect_b as (\n\n select * from a\n where a.dbt_audit_row_hash in (select b.dbt_audit_row_hash from b)\n\n ),\n\n a_except_b as (\n\n select * from a\n where a.dbt_audit_row_hash not in (select b.dbt_audit_row_hash from b)\n\n ),\n\n b_except_a as (\n\n select * from b\n where b.dbt_audit_row_hash not in (select a.dbt_audit_row_hash from a)\n\n ) \n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._generate_null_safe_surrogate_key", + "macro.audit_helper.event_time_filter", + "macro.dbt.cast" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default___classify_audit_row_status": { + "name": "default___classify_audit_row_status", + "package_name": "audit_helper", + "path": "macros/utils/_classify_audit_row_status.sql", + "original_file_path": "macros/utils/_classify_audit_row_status.sql", + "unique_id": "macro.audit_helper.default___classify_audit_row_status", + "macro_sql": "{%- macro default___classify_audit_row_status() -%}\n case \n when max(dbt_audit_pk_row_num) over (partition by dbt_audit_surrogate_key) > 1 then 'nonunique_pk'\n when dbt_audit_in_a and dbt_audit_in_b then 'identical'\n when {{ dbt.bool_or('dbt_audit_in_a') }} over (partition by dbt_audit_surrogate_key, dbt_audit_pk_row_num) \n and {{ dbt.bool_or('dbt_audit_in_b') }} over (partition by dbt_audit_surrogate_key, dbt_audit_pk_row_num)\n then 'modified'\n when dbt_audit_in_a then 'removed'\n when dbt_audit_in_b then 'added'\n end\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.bool_or" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default___count_num_rows_in_status": { + "name": "default___count_num_rows_in_status", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper.default___count_num_rows_in_status", + "macro_sql": "{%- macro default___count_num_rows_in_status() -%}\n count(distinct dbt_audit_surrogate_key, dbt_audit_pk_row_num) over (partition by dbt_audit_row_status)\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default___generate_null_safe_surrogate_key": { + "name": "default___generate_null_safe_surrogate_key", + "package_name": "audit_helper", + "path": "macros/utils/_generate_null_safe_sk.sql", + "original_file_path": "macros/utils/_generate_null_safe_sk.sql", + "unique_id": "macro.audit_helper.default___generate_null_safe_surrogate_key", + "macro_sql": "{%- macro default___generate_null_safe_surrogate_key(field_list) -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n {%- do fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '_dbt_audit_helper_surrogate_key_null_')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- do fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.concat", + "macro.dbt.hash", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default___generate_set_results": { + "name": "default___generate_set_results", + "package_name": "audit_helper", + "path": "macros/utils/_generate_set_results.sql", + "original_file_path": "macros/utils/_generate_set_results.sql", + "unique_id": "macro.audit_helper.default___generate_set_results", + "macro_sql": "{% macro default___generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props) %}\n {% set joined_cols = columns | join(\", \") %}\n\n a_base as (\n select \n {{ joined_cols }}, \n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key\n from ( {{- a_query -}} ) a_base_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n b_base as (\n select \n {{ joined_cols }}, \n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key\n from ( {{- b_query -}} ) b_base_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n a as (\n select \n *, \n row_number() over (partition by dbt_audit_surrogate_key order by dbt_audit_surrogate_key) as dbt_audit_pk_row_num\n from a_base\n ),\n\n b as (\n select \n *, \n row_number() over (partition by dbt_audit_surrogate_key order by dbt_audit_surrogate_key) as dbt_audit_pk_row_num\n from b_base\n ),\n\n a_intersect_b as (\n\n select * from a\n {{ dbt.intersect() }}\n select * from b\n\n ),\n\n a_except_b as (\n\n select * from a\n {{ dbt.except() }}\n select * from b\n\n ),\n\n b_except_a as (\n\n select * from b\n {{ dbt.except() }}\n select * from a\n\n )\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._generate_null_safe_surrogate_key", + "macro.audit_helper.event_time_filter", + "macro.dbt.except", + "macro.dbt.intersect" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_all_columns": { + "name": "default__compare_all_columns", + "package_name": "audit_helper", + "path": "macros/compare_all_columns.sql", + "original_file_path": "macros/compare_all_columns.sql", + "unique_id": "macro.audit_helper.default__compare_all_columns", + "macro_sql": "{% macro default__compare_all_columns( a_relation, b_relation, primary_key, exclude_columns=[], summarize=true ) -%}\n\n {% set column_names = dbt_utils.get_filtered_columns_in_relation(from=a_relation, except=exclude_columns) %}\n\n {# We explictly select the primary_key and rename to support any sql as the primary_key -\n a column or concatenated columns. this assumes that a_relation and b_relation do not already \n have a field named dbt_audit_helper_pk #}\n\n {% set a_query %} \n select\n *,\n {{ primary_key }} as dbt_audit_helper_pk\n from {{ a_relation }}\n {% endset %}\n\n {% set b_query %}\n select\n *,\n {{ primary_key }} as dbt_audit_helper_pk\n from {{ b_relation }}\n {% endset %}\n\n {% for column_name in column_names %}\n\n {% set audit_query = audit_helper.compare_column_values_verbose(\n a_query=a_query,\n b_query=b_query,\n primary_key=\"dbt_audit_helper_pk\",\n column_to_compare=column_name\n ) %}\n\n /* Create a query combining results from all columns so that the user, or the \n test suite, can examine all at once.\n */\n \n {% if loop.first %}\n\n /* Create a CTE that wraps all the unioned subqueries that are created\n in this for loop\n */\n with main as ( \n\n {% endif %}\n\n /* There will be one audit_query subquery for each column\n */\n ( {{ audit_query }} )\n\n {% if not loop.last %}\n\n union all\n\n {% else %}\n\n ), \n \n {%- if summarize %}\n\n final as (\n select\n upper(column_name) as column_name,\n sum(case when perfect_match then 1 else 0 end) as perfect_match,\n sum(case when null_in_a then 1 else 0 end) as null_in_a,\n sum(case when null_in_b then 1 else 0 end) as null_in_b,\n sum(case when missing_from_a then 1 else 0 end) as missing_from_a,\n sum(case when missing_from_b then 1 else 0 end) as missing_from_b,\n sum(case when conflicting_values then 1 else 0 end) as conflicting_values\n from main\n group by 1\n order by column_name\n )\n\n {%- else %}\n\n final as (\n select\n primary_key, \n upper(column_name) as column_name,\n perfect_match,\n null_in_a,\n null_in_b,\n missing_from_a,\n missing_from_b,\n conflicting_values\n from main \n order by primary_key\n )\n\n {%- endif %}\n\n select * from final\n \n {% endif %}\n\n {% endfor %}\n \n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.compare_column_values_verbose", + "macro.dbt_utils.get_filtered_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_and_classify_query_results": { + "name": "default__compare_and_classify_query_results", + "package_name": "audit_helper", + "path": "macros/compare_and_classify_query_results.sql", + "original_file_path": "macros/compare_and_classify_query_results.sql", + "unique_id": "macro.audit_helper.default__compare_and_classify_query_results", + "macro_sql": "{% macro default__compare_and_classify_query_results(a_query, b_query, primary_key_columns, columns, event_time, sample_limit) %}\n\n {% set columns = audit_helper._ensure_all_pks_are_in_column_set(primary_key_columns, columns) %}\n {% set joined_cols = columns | join(\", \") %}\n\n {% if event_time %}\n {% set event_time_props = audit_helper._get_comparison_bounds(a_query, b_query, event_time) %}\n {% endif %}\n\n with \n\n {{ audit_helper._generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props)}}\n \n ,\n\n all_records as (\n\n select\n *,\n true as dbt_audit_in_a,\n true as dbt_audit_in_b\n from a_intersect_b\n\n union all\n\n select\n *,\n true as dbt_audit_in_a,\n false as dbt_audit_in_b\n from a_except_b\n\n union all\n\n select\n *,\n false as dbt_audit_in_a,\n true as dbt_audit_in_b\n from b_except_a\n\n ),\n\n classified as (\n select \n *,\n {{ audit_helper._classify_audit_row_status() }} as dbt_audit_row_status\n from all_records\n ),\n\n final as (\n select \n *,\n {{ audit_helper._count_num_rows_in_status() }} as dbt_audit_num_rows_in_status,\n -- using dense_rank so that modified rows (which have a full row for both the left and right side) both get picked up in the sample. \n -- For every other type this is equivalent to a row_number()\n dense_rank() over (partition by dbt_audit_row_status order by dbt_audit_surrogate_key, dbt_audit_pk_row_num) as dbt_audit_sample_number\n from classified\n )\n\n select * from final\n {% if sample_limit %}\n where dbt_audit_sample_number <= {{ sample_limit }}\n {% endif %}\n order by dbt_audit_row_status, dbt_audit_sample_number\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._classify_audit_row_status", + "macro.audit_helper._count_num_rows_in_status", + "macro.audit_helper._ensure_all_pks_are_in_column_set", + "macro.audit_helper._generate_set_results", + "macro.audit_helper._get_comparison_bounds" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_column_values": { + "name": "default__compare_column_values", + "package_name": "audit_helper", + "path": "macros/compare_column_values.sql", + "original_file_path": "macros/compare_column_values.sql", + "unique_id": "macro.audit_helper.default__compare_column_values", + "macro_sql": "{% macro default__compare_column_values(a_query, b_query, primary_key, column_to_compare, emojis, a_relation_name, b_relation_name) -%}\nwith a_query as (\n {{ a_query }}\n),\n\nb_query as (\n {{ b_query }}\n),\n\njoined as (\n select\n coalesce(a_query.{{ primary_key }}, b_query.{{ primary_key }}) as {{ primary_key }},\n a_query.{{ column_to_compare }} as a_query_value,\n b_query.{{ column_to_compare }} as b_query_value,\n case\n when a_query.{{ column_to_compare }} = b_query.{{ column_to_compare }} then '{% if emojis %}\u2705: {% endif %}perfect match'\n when a_query.{{ column_to_compare }} is null and b_query.{{ column_to_compare }} is null then '{% if emojis %}\u2705: {% endif %}both are null'\n when a_query.{{ primary_key }} is null then '{% if emojis %}\ud83e\udd37: {% endif %}missing from {{ a_relation_name }}'\n when b_query.{{ primary_key }} is null then '{% if emojis %}\ud83e\udd37: {% endif %}missing from {{ b_relation_name }}'\n when a_query.{{ column_to_compare }} is null then '{% if emojis %}\ud83e\udd37: {% endif %}value is null in {{ a_relation_name }} only'\n when b_query.{{ column_to_compare }} is null then '{% if emojis %}\ud83e\udd37: {% endif %}value is null in {{ b_relation_name }} only'\n when a_query.{{ column_to_compare }} != b_query.{{ column_to_compare }} then '{% if emojis %}\u274c: {% endif %}\u200dvalues do not match'\n else 'unknown' -- this should never happen\n end as match_status,\n case\n when a_query.{{ column_to_compare }} = b_query.{{ column_to_compare }} then 0\n when a_query.{{ column_to_compare }} is null and b_query.{{ column_to_compare }} is null then 1\n when a_query.{{ primary_key }} is null then 2\n when b_query.{{ primary_key }} is null then 3\n when a_query.{{ column_to_compare }} is null then 4\n when b_query.{{ column_to_compare }} is null then 5\n when a_query.{{ column_to_compare }} != b_query.{{ column_to_compare }} then 6\n else 7 -- this should never happen\n end as match_order\n\n from a_query\n\n full outer join b_query on a_query.{{ primary_key }} = b_query.{{ primary_key }}\n),\n\naggregated as (\n select\n '{{ column_to_compare }}' as column_name,\n match_status,\n match_order,\n count(*) as count_records\n from joined\n\n group by column_name, match_status, match_order\n)\n\nselect\n column_name,\n match_status,\n count_records,\n round(100.0 * count_records / sum(count_records) over (), 2) as percent_of_total\n\nfrom aggregated\n\norder by match_order\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_column_values_verbose": { + "name": "default__compare_column_values_verbose", + "package_name": "audit_helper", + "path": "macros/compare_column_values_verbose.sql", + "original_file_path": "macros/compare_column_values_verbose.sql", + "unique_id": "macro.audit_helper.default__compare_column_values_verbose", + "macro_sql": "{% macro default__compare_column_values_verbose(a_query, b_query, primary_key, column_to_compare) -%}\nwith a_query as (\n {{ a_query }}\n),\n\nb_query as (\n {{ b_query }}\n)\n select\n coalesce(a_query.{{ primary_key }}, b_query.{{ primary_key }}) as primary_key,\n\n {% if target.name == 'postgres' or target.name == 'redshift' %}\n '{{ column_to_compare }}'::text as column_name,\n {% else %}\n '{{ column_to_compare }}' as column_name,\n {% endif %}\n\n coalesce(\n a_query.{{ column_to_compare }} = b_query.{{ column_to_compare }} and \n a_query.{{ primary_key }} is not null and b_query.{{ primary_key }} is not null,\n (a_query.{{ column_to_compare }} is null and b_query.{{ column_to_compare }} is null),\n false\n ) as perfect_match,\n a_query.{{ column_to_compare }} is null and a_query.{{ primary_key }} is not null as null_in_a,\n b_query.{{ column_to_compare }} is null and b_query.{{ primary_key }} is not null as null_in_b,\n a_query.{{ primary_key }} is null as missing_from_a,\n b_query.{{ primary_key }} is null as missing_from_b,\n coalesce(\n a_query.{{ primary_key }} is not null and b_query.{{ primary_key }} is not null and \n -- ensure that neither value is missing before considering it a conflict\n (\n a_query.{{ column_to_compare }} != b_query.{{ column_to_compare }} or -- two not-null values that do not match\n (a_query.{{ column_to_compare }} is not null and b_query.{{ column_to_compare }} is null) or -- null in b and not null in a\n (a_query.{{ column_to_compare }} is null and b_query.{{ column_to_compare }} is not null) -- null in a and not null in b\n ), \n false\n ) as conflicting_values\n -- considered a conflict if the values do not match AND at least one of the values is not null.\n\n from a_query\n\n full outer join b_query on (a_query.{{ primary_key }} = b_query.{{ primary_key }})\n\n\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_queries": { + "name": "default__compare_queries", + "package_name": "audit_helper", + "path": "macros/compare_queries.sql", + "original_file_path": "macros/compare_queries.sql", + "unique_id": "macro.audit_helper.default__compare_queries", + "macro_sql": "{% macro default__compare_queries(a_query, b_query, primary_key=None, summarize=true, limit=None) %}\n\nwith a as (\n\n {{ a_query }}\n\n),\n\nb as (\n\n {{ b_query }}\n\n),\n\na_intersect_b as (\n\n select * from a\n {{ dbt.intersect() }}\n select * from b\n\n),\n\na_except_b as (\n\n select * from a\n {{ dbt.except() }}\n select * from b\n\n),\n\nb_except_a as (\n\n select * from b\n {{ dbt.except() }}\n select * from a\n\n),\n\nall_records as (\n\n select\n *,\n true as in_a,\n true as in_b\n from a_intersect_b\n\n union all\n\n select\n *,\n true as in_a,\n false as in_b\n from a_except_b\n\n union all\n\n select\n *,\n false as in_a,\n true as in_b\n from b_except_a\n\n),\n\n{%- if summarize %}\n\nsummary_stats as (\n\n select\n\n in_a,\n in_b,\n count(*) as count\n\n from all_records\n group by 1, 2\n\n),\n\nfinal as (\n\n select\n\n *,\n round(100.0 * count / sum(count) over (), 2) as percent_of_total\n\n from summary_stats\n order by in_a desc, in_b desc\n\n)\n\n{%- else %}\n\nfinal as (\n \n select * from all_records\n where not (in_a and in_b)\n order by {{ primary_key ~ \", \" if primary_key is not none }} in_a desc, in_b desc\n\n)\n\n{%- endif %}\n\nselect * from final\n{%- if limit and not summarize %}\nlimit {{ limit }}\n{%- endif %}\n\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.except", + "macro.dbt.intersect" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_relation_columns": { + "name": "default__compare_relation_columns", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.default__compare_relation_columns", + "macro_sql": "{% macro default__compare_relation_columns(a_relation, b_relation) %}\n\nwith a_cols as (\n {{ audit_helper.get_columns_in_relation_sql(a_relation) }}\n),\n\nb_cols as (\n {{ audit_helper.get_columns_in_relation_sql(b_relation) }}\n)\n\nselect\n column_name,\n a_cols.ordinal_position as a_ordinal_position,\n b_cols.ordinal_position as b_ordinal_position,\n a_cols.data_type as a_data_type,\n b_cols.data_type as b_data_type,\n coalesce(a_cols.ordinal_position = b_cols.ordinal_position, false) as has_ordinal_position_match,\n coalesce(a_cols.data_type = b_cols.data_type, false) as has_data_type_match,\n a_cols.data_type is not null and b_cols.data_type is null as in_a_only,\n b_cols.data_type is not null and a_cols.data_type is null as in_b_only,\n b_cols.data_type is not null and a_cols.data_type is not null as in_both\nfrom a_cols\nfull outer join b_cols using (column_name)\norder by coalesce(a_cols.ordinal_position, b_cols.ordinal_position)\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.get_columns_in_relation_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_row_counts": { + "name": "default__compare_row_counts", + "package_name": "audit_helper", + "path": "macros/compare_row_counts.sql", + "original_file_path": "macros/compare_row_counts.sql", + "unique_id": "macro.audit_helper.default__compare_row_counts", + "macro_sql": "{% macro default__compare_row_counts(a_relation, b_relation) %}\n\n select\n '{{ a_relation }}' as relation_name,\n count(*) as total_records\n from {{ a_relation }}\n\n union all\n\n select\n '{{ b_relation }}' as relation_name,\n count(*) as total_records\n from {{ b_relation }}\n \n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__compare_which_query_columns_differ": { + "name": "default__compare_which_query_columns_differ", + "package_name": "audit_helper", + "path": "macros/compare_which_query_columns_differ.sql", + "original_file_path": "macros/compare_which_query_columns_differ.sql", + "unique_id": "macro.audit_helper.default__compare_which_query_columns_differ", + "macro_sql": "{% macro default__compare_which_query_columns_differ(a_query, b_query, primary_key_columns, columns, event_time) %}\n {% set columns = audit_helper._ensure_all_pks_are_in_column_set(primary_key_columns, columns) %}\n {% if event_time %}\n {% set event_time_props = audit_helper._get_comparison_bounds(event_time) %}\n {% endif %}\n\n {% set joined_cols = columns | join (\", \") %}\n\n with a as (\n select \n {{ joined_cols }},\n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key\n from ({{ a_query }}) as a_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n b as (\n select \n {{ joined_cols }},\n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key\n from ({{ b_query }}) as b_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n calculated as (\n select \n {% for column in columns %}\n {% set quoted_column = adapter.quote(column) %}\n {% set compare_statement %}\n (\n (a.{{ quoted_column }} != b.{{ quoted_column }})\n or (a.{{ quoted_column }} is null and b.{{ quoted_column }} is not null)\n or (a.{{ quoted_column }} is not null and b.{{ quoted_column }} is null)\n )\n {% endset %}\n \n {{ dbt.bool_or(compare_statement) }} as {{ column | lower }}_has_difference\n\n {%- if not loop.last %}, {% endif %}\n {% endfor %}\n from a\n inner join b on a.dbt_audit_surrogate_key = b.dbt_audit_surrogate_key\n )\n\n {% for column in columns %}\n \n select \n '{{ column }}' as column_name, \n {{ column | lower }}_has_difference as has_difference\n \n from calculated\n\n {% if not loop.last %}\n \n union all \n\n {% endif %}\n\n {% endfor %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._ensure_all_pks_are_in_column_set", + "macro.audit_helper._generate_null_safe_surrogate_key", + "macro.audit_helper._get_comparison_bounds", + "macro.audit_helper.event_time_filter", + "macro.dbt.bool_or" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__get_columns_in_relation_sql": { + "name": "default__get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.default__get_columns_in_relation_sql", + "macro_sql": "{% macro default__get_columns_in_relation_sql(relation) %}\n \n {% set columns = adapter.get_columns_in_relation(relation) %}\n {% for column in columns %}\n select \n {{ dbt.string_literal(column.name) }} as column_name, \n {{ loop.index }} as ordinal_position,\n {{ dbt.string_literal(column.data_type) }} as data_type\n\n {% if not loop.last -%}\n union all \n {%- endif %}\n {% endfor %}\n\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.string_literal" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.default__quick_are_queries_identical": { + "name": "default__quick_are_queries_identical", + "package_name": "audit_helper", + "path": "macros/quick_are_queries_identical.sql", + "original_file_path": "macros/quick_are_queries_identical.sql", + "unique_id": "macro.audit_helper.default__quick_are_queries_identical", + "macro_sql": "{% macro default__quick_are_queries_identical(query_a, query_b, columns, event_time) %}\n {% if execute %}\n {# Need to only throw this error when the macro is actually trying to be used, not during intial parse phase #}\n {# if/when unit tests get support for `enabled` config, this check can be removed as they won't be supplied for parse anyway #}\n {% do exceptions.raise_compiler_error(\"quick_are_queries_identical() is not implemented for adapter '\"~ target.type ~ \"'\" ) %}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.event_time_filter": { + "name": "event_time_filter", + "package_name": "audit_helper", + "path": "macros/utils/_get_comparison_bounds.sql", + "original_file_path": "macros/utils/_get_comparison_bounds.sql", + "unique_id": "macro.audit_helper.event_time_filter", + "macro_sql": "{% macro event_time_filter(event_time_props) %}\n {% if event_time_props %}\n where {{ event_time_props[\"event_time\"] }} >= '{{ event_time_props[\"min_event_time\"] }}'\n and {{ event_time_props[\"event_time\"] }} <= '{{ event_time_props[\"max_event_time\"] }}'\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.get_columns_in_relation_sql": { + "name": "get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.get_columns_in_relation_sql", + "macro_sql": "{% macro get_columns_in_relation_sql(relation) %}\n\n{{ adapter.dispatch('get_columns_in_relation_sql', 'audit_helper')(relation) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__get_columns_in_relation_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.postgres___count_num_rows_in_status": { + "name": "postgres___count_num_rows_in_status", + "package_name": "audit_helper", + "path": "macros/utils/_count_num_rows_in_status.sql", + "original_file_path": "macros/utils/_count_num_rows_in_status.sql", + "unique_id": "macro.audit_helper.postgres___count_num_rows_in_status", + "macro_sql": "{%- macro postgres___count_num_rows_in_status() -%}\n {{ audit_helper._count_num_rows_in_status_without_distinct_window_func() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._count_num_rows_in_status_without_distinct_window_func" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.postgres__get_columns_in_relation_sql": { + "name": "postgres__get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.postgres__get_columns_in_relation_sql", + "macro_sql": "{% macro postgres__get_columns_in_relation_sql(relation) %}\n{#-\nFrom: https://github.com/dbt-labs/dbt/blob/23484b18b71010f701b5312f920f04529ceaa6b2/plugins/postgres/dbt/include/postgres/macros/adapters.sql#L32\nEdited to include ordinal_position\n-#}\n select\n ordinal_position,\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{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.quick_are_queries_identical": { + "name": "quick_are_queries_identical", + "package_name": "audit_helper", + "path": "macros/quick_are_queries_identical.sql", + "original_file_path": "macros/quick_are_queries_identical.sql", + "unique_id": "macro.audit_helper.quick_are_queries_identical", + "macro_sql": "{% macro quick_are_queries_identical(query_a, query_b, columns=[], event_time=None) %}\n {{ return (adapter.dispatch('quick_are_queries_identical', 'audit_helper')(query_a, query_b, columns, event_time)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__quick_are_queries_identical" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.quick_are_relations_identical": { + "name": "quick_are_relations_identical", + "package_name": "audit_helper", + "path": "macros/quick_are_relations_identical.sql", + "original_file_path": "macros/quick_are_relations_identical.sql", + "unique_id": "macro.audit_helper.quick_are_relations_identical", + "macro_sql": "{% macro quick_are_relations_identical(a_relation, b_relation, columns=None, event_time=None) %}\n {% if not columns %}\n {% set columns = audit_helper._get_intersecting_columns_from_relations(a_relation, b_relation) %}\n {% endif %}\n\n {{\n audit_helper.quick_are_queries_identical(\n \"select * from \" ~ a_relation,\n \"select * from \" ~ b_relation,\n columns, \n event_time\n )\n }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._get_intersecting_columns_from_relations", + "macro.audit_helper.quick_are_queries_identical" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.redshift___classify_audit_row_status": { + "name": "redshift___classify_audit_row_status", + "package_name": "audit_helper", + "path": "macros/utils/_classify_audit_row_status.sql", + "original_file_path": "macros/utils/_classify_audit_row_status.sql", + "unique_id": "macro.audit_helper.redshift___classify_audit_row_status", + "macro_sql": "{%- macro redshift___classify_audit_row_status() -%}\n {#- Redshift doesn't support bitwise operations (e.g. bool_or) inside of a window function :( -#}\n case \n when max(dbt_audit_pk_row_num) over (partition by dbt_audit_surrogate_key) > 1 then 'nonunique_pk'\n when dbt_audit_in_a and dbt_audit_in_b then 'identical'\n when max(case when dbt_audit_in_a then 1 else 0 end) over (partition by dbt_audit_surrogate_key, dbt_audit_pk_row_num) = 1\n and max(case when dbt_audit_in_b then 1 else 0 end) over (partition by dbt_audit_surrogate_key, dbt_audit_pk_row_num) = 1\n then 'modified'\n when dbt_audit_in_a then 'removed'\n when dbt_audit_in_b then 'added'\n end{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.redshift__get_columns_in_relation_sql": { + "name": "redshift__get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.redshift__get_columns_in_relation_sql", + "macro_sql": "{% macro redshift__get_columns_in_relation_sql(relation) %}\n {# You can't store the results of an info schema query to a table/view in Redshift, because the data only lives on the leader node #}\n {{ return (audit_helper.default__get_columns_in_relation_sql(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper.default__get_columns_in_relation_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.snowflake___generate_set_results": { + "name": "snowflake___generate_set_results", + "package_name": "audit_helper", + "path": "macros/utils/_generate_set_results.sql", + "original_file_path": "macros/utils/_generate_set_results.sql", + "unique_id": "macro.audit_helper.snowflake___generate_set_results", + "macro_sql": "{% macro snowflake___generate_set_results(a_query, b_query, primary_key_columns, columns, event_time_props) %}\n {% set joined_cols = columns | join(\", \") %}\n a as (\n select \n {{ joined_cols }}, \n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key,\n row_number() over (partition by dbt_audit_surrogate_key order by dbt_audit_surrogate_key ) as dbt_audit_pk_row_num,\n hash({{ joined_cols }}, dbt_audit_pk_row_num) as dbt_audit_row_hash\n from ( {{- a_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n b as (\n select \n {{ joined_cols }}, \n {{ audit_helper._generate_null_safe_surrogate_key(primary_key_columns) }} as dbt_audit_surrogate_key,\n row_number() over (partition by dbt_audit_surrogate_key order by dbt_audit_surrogate_key ) as dbt_audit_pk_row_num,\n hash({{ joined_cols }}, dbt_audit_pk_row_num) as dbt_audit_row_hash\n from ( {{- b_query -}} )\n {{ audit_helper.event_time_filter(event_time_props) }}\n ),\n\n a_intersect_b as (\n\n select * from a\n where a.dbt_audit_row_hash in (select b.dbt_audit_row_hash from b)\n\n ),\n\n a_except_b as (\n\n select * from a\n where a.dbt_audit_row_hash not in (select b.dbt_audit_row_hash from b)\n\n ),\n\n b_except_a as (\n\n select * from b\n where b.dbt_audit_row_hash not in (select a.dbt_audit_row_hash from a)\n\n )\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._generate_null_safe_surrogate_key", + "macro.audit_helper.event_time_filter" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.snowflake__get_columns_in_relation_sql": { + "name": "snowflake__get_columns_in_relation_sql", + "package_name": "audit_helper", + "path": "macros/compare_relation_columns.sql", + "original_file_path": "macros/compare_relation_columns.sql", + "unique_id": "macro.audit_helper.snowflake__get_columns_in_relation_sql", + "macro_sql": "{% macro snowflake__get_columns_in_relation_sql(relation) %}\n{#-\nFrom: https://github.com/dbt-labs/dbt/blob/dev/louisa-may-alcott/plugins/snowflake/dbt/include/snowflake/macros/adapters.sql#L48\nEdited to include ordinal_position\n-#}\n select\n ordinal_position,\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from\n {{ relation.information_schema('columns') }}\n\n where table_name ilike '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema ilike '{{ relation.schema }}'\n {% endif %}\n {% if relation.database %}\n and table_catalog ilike '{{ relation.database }}'\n {% endif %}\n order by ordinal_position\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.audit_helper.snowflake__quick_are_queries_identical": { + "name": "snowflake__quick_are_queries_identical", + "package_name": "audit_helper", + "path": "macros/quick_are_queries_identical.sql", + "original_file_path": "macros/quick_are_queries_identical.sql", + "unique_id": "macro.audit_helper.snowflake__quick_are_queries_identical", + "macro_sql": "{% macro snowflake__quick_are_queries_identical(query_a, query_b, columns, event_time) %}\n {% set joined_cols = columns | join(\", \") %}\n {% if event_time %}\n {% set event_time_props = audit_helper._get_comparison_bounds(a_query, b_query, event_time) %}\n {% endif %}\n\n select count(distinct hash_result) = 1 as are_tables_identical\n from (\n select hash_agg({{ joined_cols }}) as hash_result\n from ({{ query_a }}) query_a_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n\n union all\n \n select hash_agg({{ joined_cols }}) as hash_result\n from ({{ query_b }}) query_b_subq\n {{ audit_helper.event_time_filter(event_time_props) }}\n\n ) as hashes\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.audit_helper._get_comparison_bounds", + "macro.audit_helper.event_time_filter" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt._bigquery__get_matching_schemata": { + "name": "_bigquery__get_matching_schemata", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern_sql.sql", + "original_file_path": "macros/relations/get_relations_by_pattern_sql.sql", + "unique_id": "macro.dbt._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 %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt._run_query_with_options": { + "name": "_run_query_with_options", + "package_name": "dbt", + "path": "macros/etc/statement_with_options.sql", + "original_file_path": "macros/etc/statement_with_options.sql", + "unique_id": "macro.dbt._run_query_with_options", + "macro_sql": "{% macro _run_query_with_options(sql, options={}) %}\n {% call _statement_with_options(\"run_query_statement\", fetch_result=true, auto_begin=false, options=options) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt._statement_with_options" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt._split_part_negative": { + "name": "_split_part_negative", + "package_name": "dbt", + "path": "macros/utils/split_part.sql", + "original_file_path": "macros/utils/split_part.sql", + "unique_id": "macro.dbt._split_part_negative", + "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }})\n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 + {{ part_number }}\n )\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt._statement_with_options": { + "name": "_statement_with_options", + "package_name": "dbt", + "path": "macros/etc/statement_with_options.sql", + "original_file_path": "macros/etc/statement_with_options.sql", + "unique_id": "macro.dbt._statement_with_options", + "macro_sql": "{%- macro _statement_with_options(name=None, fetch_result=False, auto_begin=True, language='sql', options={}) -%}\n {%- if execute: -%}\n {%- set compiled_code = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n {{ write(compiled_code) }}\n {%- endif -%}\n {%- if language == 'sql'-%}\n {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result, options=options) -%}\n {%- elif language == 'python' -%}\n {%- set res = submit_python_job(model, compiled_code) -%}\n {#-- TODO: What should table be for python models? --#}\n {%- set table = None -%}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.after_commit": { + "name": "after_commit", + "package_name": "dbt", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt.after_commit", + "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.aggregated_unique_field": { + "name": "aggregated_unique_field", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_unique.sql", + "original_file_path": "macros/generic_test_sql/aggregated_unique.sql", + "unique_id": "macro.dbt.aggregated_unique_field", + "macro_sql": "{% macro aggregated_unique_field(column_name) %}\n {{ return(adapter.dispatch('aggregated_unique_field', 'dbt')(column_name)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__aggregated_unique_field" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.alter_column_comment": { + "name": "alter_column_comment", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__alter_column_comment" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.alter_column_type": { + "name": "alter_column_type", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__alter_column_type" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.alter_relation_add_remove_columns": { + "name": "alter_relation_add_remove_columns", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__alter_relation_add_remove_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.alter_relation_comment": { + "name": "alter_relation_comment", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__alter_relation_comment" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.any_value": { + "name": "any_value", + "package_name": "dbt", + "path": "macros/utils/any_value.sql", + "original_file_path": "macros/utils/any_value.sql", + "unique_id": "macro.dbt.any_value", + "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__any_value" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.apply_grants": { + "name": "apply_grants", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.apply_grants", + "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__apply_grants" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.array_append": { + "name": "array_append", + "package_name": "dbt", + "path": "macros/utils/array_append.sql", + "original_file_path": "macros/utils/array_append.sql", + "unique_id": "macro.dbt.array_append", + "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__array_append" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.array_concat": { + "name": "array_concat", + "package_name": "dbt", + "path": "macros/utils/array_concat.sql", + "original_file_path": "macros/utils/array_concat.sql", + "unique_id": "macro.dbt.array_concat", + "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__array_concat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.array_construct": { + "name": "array_construct", + "package_name": "dbt", + "path": "macros/utils/array_construct.sql", + "original_file_path": "macros/utils/array_construct.sql", + "unique_id": "macro.dbt.array_construct", + "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__array_construct" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.assert_columns_equivalent": { + "name": "assert_columns_equivalent", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.assert_columns_equivalent", + "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n {#-- First ensure the user has defined 'columns' in yaml specification --#}\n {%- set user_defined_columns = model['columns'] -%}\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {#-- Obtain the column schema provided by sql file. #}\n {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n {#-- create dictionaries with name and formatted data type and strings for exception #}\n {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n {%- set yaml_columns = format_columns(schema_file_provided_columns) -%}\n\n {%- if sql_columns|length != yaml_columns|length -%}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n\n {%- for sql_col in sql_columns -%}\n {%- set yaml_col = [] -%}\n {%- for this_col in yaml_columns -%}\n {%- if this_col['name'] == sql_col['name'] -%}\n {%- do yaml_col.append(this_col) -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if not yaml_col -%}\n {#-- Column with name not found in yaml #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n {#-- Column data types don't match #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- endfor -%}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.format_columns", + "macro.dbt.get_column_schema_from_query", + "macro.dbt.get_empty_schema_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.before_begin": { + "name": "before_begin", + "package_name": "dbt", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt.before_begin", + "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.bigquery__get_tables_by_pattern_sql": { + "name": "bigquery__get_tables_by_pattern_sql", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern_sql.sql", + "original_file_path": "macros/relations/get_relations_by_pattern_sql.sql", + "unique_id": "macro.dbt.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=_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 {{ adapter.dispatch('get_table_types_sql')() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils._bigquery__get_matching_schemata", + "macro.dbt_utils.default__get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.bigquery__t_database_name": { + "name": "bigquery__t_database_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.bigquery__t_database_name", + "macro_sql": "{% macro bigquery__t_database_name() %}\n {{ return(env_var('GOOGLE_CLOUD_PROJECT')) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.bool_or": { + "name": "bool_or", + "package_name": "dbt", + "path": "macros/utils/bool_or.sql", + "original_file_path": "macros/utils/bool_or.sql", + "unique_id": "macro.dbt.bool_or", + "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__bool_or" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.build_config_dict": { + "name": "build_config_dict", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.build_config_dict", + "macro_sql": "{% macro build_config_dict(model) %}\n {%- set config_dict = {} -%}\n {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n {%- for key, default in config_dbt_used -%}\n {# weird type testing with enum, would be much easier to write this logic in Python! #}\n {%- if key == \"language\" -%}\n {%- set value = \"python\" -%}\n {%- endif -%}\n {%- set value = model.config.get(key, default) -%}\n {%- do config_dict.update({key: value}) -%}\n {%- endfor -%}\n {# Handle dbt.config.meta_get() calls - use separate dict to avoid overwriting native configs #}\n {%- set meta_dict = {} -%}\n {%- if model.config.meta_keys_used -%}\n {% set meta_dbt_used = zip(model.config.meta_keys_used, model.config.meta_keys_defaults) | list %}\n {%- for key, default in meta_dbt_used -%}\n {%- if model.config.meta and key in model.config.meta -%}\n {%- set value = model.config.meta[key] -%}\n {%- else -%}\n {%- set value = default -%}\n {%- endif -%}\n {%- do meta_dict.update({key: value}) -%}\n {%- endfor -%}\n {%- endif -%}\nconfig_dict = {{ config_dict }}\nmeta_dict = {{ meta_dict }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.build_ref_function": { + "name": "build_ref_function", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.build_ref_function", + "macro_sql": "{% macro build_ref_function(model) %}\n\n {%- set ref_dict = {} -%}\n {%- for _ref in model.refs -%}\n {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n\n {#\n We want to get the string of the returned relation by calling .render() in order to skip sample/empty\n mode rendering logic. However, people override the default ref macro, and often return a string instead\n of a relation (like the ref macro does by default). Thus, to make sure we dont blow things up, we have\n to ensure the resolved relation has a .render() method.\n #}\n {%- if resolved.render is defined and resolved.render is callable -%}\n {%- set resolved = resolved.render() -%}\n {%- endif -%}\n\n {%- if _ref.get('version') -%}\n {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n {%- endif -%}\n {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef ref(*args, **kwargs):\n refs = {{ ref_dict | tojson }}\n key = '.'.join(args)\n version = kwargs.get(\"v\") or kwargs.get(\"version\")\n if version:\n key += f\".v{version}\"\n dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n return dbt_load_df_function(refs[key])\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.resolve_model_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.build_snapshot_staging_table": { + "name": "build_snapshot_staging_table", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.build_snapshot_staging_table", + "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set temp_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, temp_relation, select) }}\n {% endcall %}\n\n {% do return(temp_relation) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.create_table_as", + "macro.dbt.make_temp_relation", + "macro.dbt.snapshot_staging_table", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.build_snapshot_table": { + "name": "build_snapshot_table", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.build_snapshot_table", + "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__build_snapshot_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.build_source_function": { + "name": "build_source_function", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.build_source_function", + "macro_sql": "{% macro build_source_function(model) %}\n\n {%- set source_dict = {} -%}\n {%- for _source in model.sources -%}\n {%- set resolved = source(*_source) -%}\n {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n sources = {{ source_dict | tojson }}\n key = '.'.join(args)\n return dbt_load_df_function(sources[key])\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.resolve_model_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.call_dcl_statements": { + "name": "call_dcl_statements", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.call_dcl_statements", + "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__call_dcl_statements" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.can_clone_table": { + "name": "can_clone_table", + "package_name": "dbt", + "path": "macros/materializations/models/clone/can_clone_table.sql", + "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", + "unique_id": "macro.dbt.can_clone_table", + "macro_sql": "{% macro can_clone_table() %}\n {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__can_clone_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.cast": { + "name": "cast", + "package_name": "dbt", + "path": "macros/utils/cast.sql", + "original_file_path": "macros/utils/cast.sql", + "unique_id": "macro.dbt.cast", + "macro_sql": "{% macro cast(field, type) %}\n {{ return(adapter.dispatch('cast', 'dbt') (field, type)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__cast" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.cast_bool_to_text": { + "name": "cast_bool_to_text", + "package_name": "dbt", + "path": "macros/utils/cast_bool_to_text.sql", + "original_file_path": "macros/utils/cast_bool_to_text.sql", + "unique_id": "macro.dbt.cast_bool_to_text", + "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__cast_bool_to_text" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.check_for_schema_changes": { + "name": "check_for_schema_changes", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.check_for_schema_changes", + "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n {{ return(adapter.dispatch('check_for_schema_changes', 'dbt')(source_relation, target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__check_for_schema_changes" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.check_schema_exists": { + "name": "check_schema_exists", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__check_schema_exists" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.check_schema_exists_like": { + "name": "check_schema_exists_like", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.check_schema_exists_like", + "macro_sql": "{% macro check_schema_exists_like(schema) -%}\n {{ return(adapter.dispatch('check_schema_exists_like', 'dbt')(schema)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__check_schema_exists_like" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.check_time_data_types": { + "name": "check_time_data_types", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.check_time_data_types", + "macro_sql": "{% macro check_time_data_types(sql) %}\n {% set dbt_updated_at_data_type = get_updated_at_column_data_type(sql) %}\n {% set snapshot_get_time_data_type = get_snapshot_get_time_data_type() %}\n {#- Assumes strategy.hard_deletes (which builds the SQL)\n agrees with get_hard_deletes_behavior(config); true for all built-in strategies. #}\n {% set hard_deletes = adapter.get_hard_deletes_behavior(config) %}\n {% if hard_deletes in ['invalidate', 'new_record'] and snapshot_get_time_data_type is not none and dbt_updated_at_data_type is not none and snapshot_get_time_data_type != dbt_updated_at_data_type %}\n {% if exceptions.warn_snapshot_timestamp_data_types %}\n {{ exceptions.warn_snapshot_timestamp_data_types(snapshot_get_time_data_type, dbt_updated_at_data_type) }}\n {% endif %}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_snapshot_get_time_data_type", + "macro.dbt.get_updated_at_column_data_type" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.collect_freshness": { + "name": "collect_freshness", + "package_name": "dbt", + "path": "macros/adapters/freshness.sql", + "original_file_path": "macros/adapters/freshness.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__collect_freshness" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.collect_freshness_custom_sql": { + "name": "collect_freshness_custom_sql", + "package_name": "dbt", + "path": "macros/adapters/freshness.sql", + "original_file_path": "macros/adapters/freshness.sql", + "unique_id": "macro.dbt.collect_freshness_custom_sql", + "macro_sql": "{% macro collect_freshness_custom_sql(source, loaded_at_query) %}\n {{ return(adapter.dispatch('collect_freshness_custom_sql', 'dbt')(source, loaded_at_query))}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__collect_freshness_custom_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.concat": { + "name": "concat", + "package_name": "dbt", + "path": "macros/utils/concat.sql", + "original_file_path": "macros/utils/concat.sql", + "unique_id": "macro.dbt.concat", + "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__concat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.convert_datetime": { + "name": "convert_datetime", + "package_name": "dbt", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.copy_grants": { + "name": "copy_grants", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.copy_grants", + "macro_sql": "{% macro copy_grants() %}\n {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__copy_grants" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_columns": { + "name": "create_columns", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.create_columns", + "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__create_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_csv_table": { + "name": "create_csv_table", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.create_csv_table", + "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__create_csv_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_indexes": { + "name": "create_indexes", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.create_indexes", + "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__create_indexes" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_or_replace_clone": { + "name": "create_or_replace_clone", + "package_name": "dbt", + "path": "macros/materializations/models/clone/create_or_replace_clone.sql", + "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", + "unique_id": "macro.dbt.create_or_replace_clone", + "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__create_or_replace_clone" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_or_replace_view": { + "name": "create_or_replace_view", + "package_name": "dbt", + "path": "macros/relations/view/replace.sql", + "original_file_path": "macros/relations/view/replace.sql", + "unique_id": "macro.dbt.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 {%- 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 {% set grant_config = config.get('grants') %}\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 {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.get_create_view_as_sql", + "macro.dbt.handle_existing_table", + "macro.dbt.should_full_refresh", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_schema": { + "name": "create_schema", + "package_name": "dbt", + "path": "macros/adapters/schema.sql", + "original_file_path": "macros/adapters/schema.sql", + "unique_id": "macro.dbt.create_schema", + "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__create_schema" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_table_as": { + "name": "create_table_as", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.create_table_as", + "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {# backward compatibility for create_table_as that does not support language #}\n {% if language == \"sql\" %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n {% else %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n {% endif %}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__create_table_as" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.create_view_as": { + "name": "create_view_as", + "package_name": "dbt", + "path": "macros/relations/view/create.sql", + "original_file_path": "macros/relations/view/create.sql", + "unique_id": "macro.dbt.create_view_as", + "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__create_view_as" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.current_timestamp": { + "name": "current_timestamp", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.current_timestamp", + "macro_sql": "{%- macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__current_timestamp" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.current_timestamp_backcompat": { + "name": "current_timestamp_backcompat", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.current_timestamp_backcompat", + "macro_sql": "{% macro current_timestamp_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__current_timestamp_backcompat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.current_timestamp_in_utc_backcompat": { + "name": "current_timestamp_in_utc_backcompat", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", + "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__current_timestamp_in_utc_backcompat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.databricks__get_table_types_sql": { + "name": "databricks__get_table_types_sql", + "package_name": "dbt", + "path": "macros/relations/get_table_types_sql.sql", + "original_file_path": "macros/relations/get_table_types_sql.sql", + "unique_id": "macro.dbt.databricks__get_table_types_sql", + "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.databricks__t_database_name": { + "name": "databricks__t_database_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.databricks__t_database_name", + "macro_sql": "{% macro databricks__t_database_name() %}\n {{ return(env_var('DATABRICKS_CATALOG')) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.date": { + "name": "date", + "package_name": "dbt", + "path": "macros/utils/date.sql", + "original_file_path": "macros/utils/date.sql", + "unique_id": "macro.dbt.date", + "macro_sql": "{% macro date(year, month, day) %}\n {{ return(adapter.dispatch('date', 'dbt') (year, month, day)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__date" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.date_spine": { + "name": "date_spine", + "package_name": "dbt", + "path": "macros/utils/date_spine.sql", + "original_file_path": "macros/utils/date_spine.sql", + "unique_id": "macro.dbt.date_spine", + "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__date_spine" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.date_trunc": { + "name": "date_trunc", + "package_name": "dbt", + "path": "macros/utils/date_trunc.sql", + "original_file_path": "macros/utils/date_trunc.sql", + "unique_id": "macro.dbt.date_trunc", + "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__date_trunc" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.dateadd": { + "name": "dateadd", + "package_name": "dbt", + "path": "macros/utils/dateadd.sql", + "original_file_path": "macros/utils/dateadd.sql", + "unique_id": "macro.dbt.dateadd", + "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__dateadd" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.datediff": { + "name": "datediff", + "package_name": "dbt", + "path": "macros/utils/datediff.sql", + "original_file_path": "macros/utils/datediff.sql", + "unique_id": "macro.dbt.datediff", + "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__datediff" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.dates_in_range": { + "name": "dates_in_range", + "package_name": "dbt", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "unique_id": "macro.dbt.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 Partition 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 %}", + "depends_on": { + "macros": [ + "macro.dbt.convert_datetime" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__aggregated_unique_field": { + "name": "default__aggregated_unique_field", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_unique.sql", + "original_file_path": "macros/generic_test_sql/aggregated_unique.sql", + "unique_id": "macro.dbt.default__aggregated_unique_field", + "macro_sql": "{% macro default__aggregated_unique_field(column_name) %}\n {{ dbt.safe_cast(column_name, dbt.type_string()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.safe_cast", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__alter_column_comment": { + "name": "default__alter_column_comment", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__alter_column_type": { + "name": "default__alter_column_type", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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.render() }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation.render() }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation.render() }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation.render() }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__alter_relation_add_remove_columns": { + "name": "default__alter_relation_add_remove_columns", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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.render() }}\n\n {% for column in add_columns %}\n add column {{ column.quoted }} {{ column.expanded_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.quoted }}{{ ',' if not loop.last }}\n {% endfor %}\n\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__alter_relation_comment": { + "name": "default__alter_relation_comment", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__any_value": { + "name": "default__any_value", + "package_name": "dbt", + "path": "macros/utils/any_value.sql", + "original_file_path": "macros/utils/any_value.sql", + "unique_id": "macro.dbt.default__any_value", + "macro_sql": "{% macro default__any_value(expression) -%}\n\n any_value({{ expression }})\n\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__apply_grants": { + "name": "default__apply_grants", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__apply_grants", + "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n {#-- If grant_config is {} or None, this is a no-op --#}\n {% if grant_config %}\n {% if should_revoke %}\n {#-- We think previous grants may have carried over --#}\n {#-- Show current grants and calculate diffs --#}\n {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n {% if not (needs_granting or needs_revoking) %}\n {{ log('On ' ~ relation.render() ~': All grants are in place, no revocation or granting needed.')}}\n {% endif %}\n {% else %}\n {#-- We don't think there's any chance of previous grants having carried over. --#}\n {#-- Jump straight to granting what the user has configured. --#}\n {% set needs_revoking = {} %}\n {% set needs_granting = grant_config %}\n {% endif %}\n {% if needs_granting or needs_revoking %}\n {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n {% if dcl_statement_list %}\n {{ call_dcl_statements(dcl_statement_list) }}\n {% endif %}\n {% endif %}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.call_dcl_statements", + "macro.dbt.get_dcl_statement_list", + "macro.dbt.get_show_grant_sql", + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__array_append": { + "name": "default__array_append", + "package_name": "dbt", + "path": "macros/utils/array_append.sql", + "original_file_path": "macros/utils/array_append.sql", + "unique_id": "macro.dbt.default__array_append", + "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__array_concat": { + "name": "default__array_concat", + "package_name": "dbt", + "path": "macros/utils/array_concat.sql", + "original_file_path": "macros/utils/array_concat.sql", + "unique_id": "macro.dbt.default__array_concat", + "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__array_construct": { + "name": "default__array_construct", + "package_name": "dbt", + "path": "macros/utils/array_construct.sql", + "original_file_path": "macros/utils/array_construct.sql", + "unique_id": "macro.dbt.default__array_construct", + "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__bool_or": { + "name": "default__bool_or", + "package_name": "dbt", + "path": "macros/utils/bool_or.sql", + "original_file_path": "macros/utils/bool_or.sql", + "unique_id": "macro.dbt.default__bool_or", + "macro_sql": "{% macro default__bool_or(expression) -%}\n\n bool_or({{ expression }})\n\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__build_snapshot_table": { + "name": "default__build_snapshot_table", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.default__build_snapshot_table", + "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n {% set columns = config.get('snapshot_table_column_names') or get_snapshot_table_column_names() %}\n\n select *,\n {{ strategy.scd_id }} as {{ columns.dbt_scd_id }},\n {{ strategy.updated_at }} as {{ columns.dbt_updated_at }},\n {{ strategy.updated_at }} as {{ columns.dbt_valid_from }},\n {{ get_dbt_valid_to_current(strategy, columns) }}\n {%- if strategy.hard_deletes == 'new_record' -%}\n , 'False' as {{ columns.dbt_is_deleted }}\n {% endif -%}\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_dbt_valid_to_current", + "macro.dbt.get_snapshot_table_column_names" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__call_dcl_statements": { + "name": "default__call_dcl_statements", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__call_dcl_statements", + "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n {#\n -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n -- so that they're all processed together.\n\n -- Some databases do not support this. Those adapters will need to override this macro\n -- to run each statement individually.\n #}\n {% call statement('grants') %}\n {% for dcl_statement in dcl_statement_list %}\n {{ dcl_statement }};\n {% endfor %}\n {% endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__can_clone_table": { + "name": "default__can_clone_table", + "package_name": "dbt", + "path": "macros/materializations/models/clone/can_clone_table.sql", + "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", + "unique_id": "macro.dbt.default__can_clone_table", + "macro_sql": "{% macro default__can_clone_table() %}\n {{ return(False) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__cast": { + "name": "default__cast", + "package_name": "dbt", + "path": "macros/utils/cast.sql", + "original_file_path": "macros/utils/cast.sql", + "unique_id": "macro.dbt.default__cast", + "macro_sql": "{% macro default__cast(field, type) %}\n cast({{field}} as {{type}})\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__cast_bool_to_text": { + "name": "default__cast_bool_to_text", + "package_name": "dbt", + "path": "macros/utils/cast_bool_to_text.sql", + "original_file_path": "macros/utils/cast_bool_to_text.sql", + "unique_id": "macro.dbt.default__cast_bool_to_text", + "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__check_for_schema_changes": { + "name": "default__check_for_schema_changes", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.default__check_for_schema_changes", + "macro_sql": "{% macro default__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 %}", + "depends_on": { + "macros": [ + "macro.dbt.diff_column_data_types", + "macro.dbt.diff_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__check_schema_exists": { + "name": "default__check_schema_exists", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__check_schema_exists_like": { + "name": "default__check_schema_exists_like", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.default__check_schema_exists_like", + "macro_sql": "{% macro default__check_schema_exists_like(schema) -%}\n {{ exceptions.raise_not_implemented(\n 'check_schema_exists_like macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__collect_freshness": { + "name": "default__collect_freshness", + "package_name": "dbt", + "path": "macros/adapters/freshness.sql", + "original_file_path": "macros/adapters/freshness.sql", + "unique_id": "macro.dbt.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')) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__collect_freshness_custom_sql": { + "name": "default__collect_freshness_custom_sql", + "package_name": "dbt", + "path": "macros/adapters/freshness.sql", + "original_file_path": "macros/adapters/freshness.sql", + "unique_id": "macro.dbt.default__collect_freshness_custom_sql", + "macro_sql": "{% macro default__collect_freshness_custom_sql(source, loaded_at_query) %}\n {% call statement('collect_freshness_custom_sql', fetch_result=True, auto_begin=False) -%}\n with source_query as (\n {{ loaded_at_query }}\n )\n select\n (select * from source_query) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n {% endcall %}\n {{ return(load_result('collect_freshness_custom_sql')) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__concat": { + "name": "default__concat", + "package_name": "dbt", + "path": "macros/utils/concat.sql", + "original_file_path": "macros/utils/concat.sql", + "unique_id": "macro.dbt.default__concat", + "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__copy_grants": { + "name": "default__copy_grants", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__copy_grants", + "macro_sql": "{% macro default__copy_grants() %}\n {{ return(True) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_columns": { + "name": "default__create_columns", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.default__create_columns", + "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation.render() }} add column {{ adapter.quote(column.name) }} {{ column.expanded_data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_csv_table": { + "name": "default__create_csv_table", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_indexes": { + "name": "default__create_indexes", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.default__create_indexes", + "macro_sql": "{% macro default__create_indexes(relation) -%}\n {#- DIVERGENCE: FIXME: v2-parser stores unset `indexes` as null in the manifest, so\n `config.get('indexes', default=[])` returns None under dbt-core (1.x) and the\n for-loop blows up with \"NoneType is not iterable\". Coalesce to []. -#}\n {%- set _indexes = config.get('indexes', default=[]) or [] -%}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_index_sql", + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_or_replace_clone": { + "name": "default__create_or_replace_clone", + "package_name": "dbt", + "path": "macros/materializations/models/clone/create_or_replace_clone.sql", + "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", + "unique_id": "macro.dbt.default__create_or_replace_clone", + "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace table {{ this_relation.render() }} clone {{ defer_relation.render() }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_schema": { + "name": "default__create_schema", + "package_name": "dbt", + "path": "macros/adapters/schema.sql", + "original_file_path": "macros/adapters/schema.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_table_as": { + "name": "default__create_table_as", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.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 {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced and (not temporary) %}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- set sql = get_select_subquery(sql) %}\n {% endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_assert_columns_equivalent", + "macro.dbt.get_select_subquery", + "macro.dbt.get_table_columns_and_constraints" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__create_view_as": { + "name": "default__create_view_as", + "package_name": "dbt", + "path": "macros/relations/view/create.sql", + "original_file_path": "macros/relations/view/create.sql", + "unique_id": "macro.dbt.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.render() }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_assert_columns_equivalent" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__current_timestamp": { + "name": "default__current_timestamp", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__current_timestamp_backcompat": { + "name": "default__current_timestamp_backcompat", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.default__current_timestamp_backcompat", + "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n current_timestamp::timestamp\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__current_timestamp_in_utc_backcompat": { + "name": "default__current_timestamp_in_utc_backcompat", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", + "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__current_timestamp_backcompat" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__date": { + "name": "default__date", + "package_name": "dbt", + "path": "macros/utils/date.sql", + "original_file_path": "macros/utils/date.sql", + "unique_id": "macro.dbt.default__date", + "macro_sql": "{% macro default__date(year, month, day) -%}\n {%- set dt = modules.datetime.date(year, month, day) -%}\n {%- set iso_8601_formatted_date = dt.strftime('%Y-%m-%d') -%}\n to_date('{{ iso_8601_formatted_date }}', 'YYYY-MM-DD')\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__date_spine": { + "name": "default__date_spine", + "package_name": "dbt", + "path": "macros/utils/date_spine.sql", + "original_file_path": "macros/utils/date_spine.sql", + "unique_id": "macro.dbt.default__date_spine", + "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n {# call as follows:\n\n date_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n ) #}\n\n\n with rawdata as (\n\n {{dbt.generate_series(\n dbt.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n ),\n\n all_periods as (\n\n select (\n {{\n dbt.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\n filtered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n )\n\n select * from filtered\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.dateadd", + "macro.dbt.generate_series", + "macro.dbt.get_intervals_between" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__date_trunc": { + "name": "default__date_trunc", + "package_name": "dbt", + "path": "macros/utils/date_trunc.sql", + "original_file_path": "macros/utils/date_trunc.sql", + "unique_id": "macro.dbt.default__date_trunc", + "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__dateadd": { + "name": "default__dateadd", + "package_name": "dbt", + "path": "macros/utils/dateadd.sql", + "original_file_path": "macros/utils/dateadd.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__datediff": { + "name": "default__datediff", + "package_name": "dbt", + "path": "macros/utils/datediff.sql", + "original_file_path": "macros/utils/datediff.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__diff_column_data_types": { + "name": "default__diff_column_data_types", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.default__diff_column_data_types", + "macro_sql": "{% macro default__diff_column_data_types(source_columns, target_columns) %}\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.expanded_data_type != tc.expanded_data_type and not sc.can_expand_to(other_column=tc) %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.expanded_data_type } ) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_materialized_view": { + "name": "default__drop_materialized_view", + "package_name": "dbt", + "path": "macros/relations/materialized_view/drop.sql", + "original_file_path": "macros/relations/materialized_view/drop.sql", + "unique_id": "macro.dbt.default__drop_materialized_view", + "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n drop materialized view if exists {{ relation.render() }} cascade\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_relation": { + "name": "default__drop_relation", + "package_name": "dbt", + "path": "macros/relations/drop.sql", + "original_file_path": "macros/relations/drop.sql", + "unique_id": "macro.dbt.default__drop_relation", + "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {{ get_drop_sql(relation) }}\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_drop_sql", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_schema": { + "name": "default__drop_schema", + "package_name": "dbt", + "path": "macros/adapters/schema.sql", + "original_file_path": "macros/adapters/schema.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_schema_named": { + "name": "default__drop_schema_named", + "package_name": "dbt", + "path": "macros/relations/schema.sql", + "original_file_path": "macros/relations/schema.sql", + "unique_id": "macro.dbt.default__drop_schema_named", + "macro_sql": "{% macro default__drop_schema_named(schema_name) %}\n {% set schema_relation = api.Relation.create(schema=schema_name) %}\n {{ adapter.drop_schema(schema_relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_table": { + "name": "default__drop_table", + "package_name": "dbt", + "path": "macros/relations/table/drop.sql", + "original_file_path": "macros/relations/table/drop.sql", + "unique_id": "macro.dbt.default__drop_table", + "macro_sql": "{% macro default__drop_table(relation) -%}\n drop table if exists {{ relation.render() }} cascade\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__drop_view": { + "name": "default__drop_view", + "package_name": "dbt", + "path": "macros/relations/view/drop.sql", + "original_file_path": "macros/relations/view/drop.sql", + "unique_id": "macro.dbt.default__drop_view", + "macro_sql": "{% macro default__drop_view(relation) -%}\n drop view if exists {{ relation.render() }} cascade\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__equals": { + "name": "default__equals", + "package_name": "dbt", + "path": "macros/utils/equals.sql", + "original_file_path": "macros/utils/equals.sql", + "unique_id": "macro.dbt.default__equals", + "macro_sql": "{% macro default__equals(expr1, expr2) -%}\n {%- if dbt_version.startswith('2.') -%}\n {{ adapter.render_equals(expr1, expr2) }}\n {%- else -%}\n {%- if adapter.behavior.enable_truthy_nulls_equals_macro.no_warn %}\n case when (({{ expr1 }} = {{ expr2 }}) or ({{ expr1 }} is null and {{ expr2 }} is null))\n then 0\n else 1\n end = 0\n {%- else -%}\n ({{ expr1 }} = {{ expr2 }})\n {%- endif %}\n {%- endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__escape_single_quotes": { + "name": "default__escape_single_quotes", + "package_name": "dbt", + "path": "macros/utils/escape_single_quotes.sql", + "original_file_path": "macros/utils/escape_single_quotes.sql", + "unique_id": "macro.dbt.default__escape_single_quotes", + "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__except": { + "name": "default__except", + "package_name": "dbt", + "path": "macros/utils/except.sql", + "original_file_path": "macros/utils/except.sql", + "unique_id": "macro.dbt.default__except", + "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__format_column": { + "name": "default__format_column", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.default__format_column", + "macro_sql": "{% macro default__format_column(column) -%}\n {% set data_type = column.dtype %}\n {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__formatted_scalar_function_args_javascript": { + "name": "default__formatted_scalar_function_args_javascript", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__formatted_scalar_function_args_javascript", + "macro_sql": "{% macro default__formatted_scalar_function_args_javascript() %}\n {% set msg = \"formatted_scalar_function_args_javascript not implemented for adapter \" ~ adapter.type() %}\n {% do exceptions.raise_compiler_error(msg) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__formatted_scalar_function_args_sql": { + "name": "default__formatted_scalar_function_args_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__formatted_scalar_function_args_sql", + "macro_sql": "{% macro default__formatted_scalar_function_args_sql() %}\n {% set args = [] %}\n {% for arg in model.arguments -%}\n {%- do args.append(arg.name ~ ' ' ~ arg.data_type) -%}\n {%- endfor %}\n {{ args | join(', ') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__function_execute_build_sql": { + "name": "default__function_execute_build_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/helpers.sql", + "original_file_path": "macros/materializations/functions/helpers.sql", + "unique_id": "macro.dbt.default__function_execute_build_sql", + "macro_sql": "{% macro default__function_execute_build_sql(build_sql, existing_relation, target_relation) %}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ adapter.commit() }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__generate_alias_name": { + "name": "default__generate_alias_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_alias.sql", + "original_file_path": "macros/get_custom_name/get_custom_alias.sql", + "unique_id": "macro.dbt.default__generate_alias_name", + "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name -%}\n\n {{ custom_alias_name | trim }}\n\n {%- elif node.version -%}\n\n {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n {%- else -%}\n\n {{ node.name }}\n\n {%- endif -%}\n\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__generate_database_name": { + "name": "default__generate_database_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_database.sql", + "original_file_path": "macros/get_custom_name/get_custom_database.sql", + "unique_id": "macro.dbt.default__generate_database_name", + "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {#- Only consult the catalog when the model actually references one. Adapters that\n don't support catalog integrations (e.g. redshift, postgres, spark) raise from\n build_catalog_relation, which would otherwise abort database resolution and drop\n the model's `database` config. -#}\n {%- set catalog_name = node.config.get('catalog_name') if (node is not none and node.config is defined) else none -%}\n {%- if catalog_name -%}\n {%- set catalog_relation = adapter.build_catalog_relation(node) -%}\n {%- if catalog_relation is not none and catalog_relation|attr('catalog_database') -%}\n {{ return(catalog_relation.catalog_database) }}\n {%- endif -%}\n {%- endif -%}\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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__generate_latest_version_pointer_alias": { + "name": "default__generate_latest_version_pointer_alias", + "package_name": "dbt", + "path": "macros/get_custom_name/get_latest_version_pointer_alias.sql", + "original_file_path": "macros/get_custom_name/get_latest_version_pointer_alias.sql", + "unique_id": "macro.dbt.default__generate_latest_version_pointer_alias", + "macro_sql": "{% macro default__generate_latest_version_pointer_alias(custom_alias_name=none, node=none) -%}\n {%- if custom_alias_name -%}\n {{ custom_alias_name | trim }}\n {%- else -%}\n {{ node.name }}\n {%- endif -%}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__generate_schema_name": { + "name": "default__generate_schema_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_schema.sql", + "original_file_path": "macros/get_custom_name/get_custom_schema.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__generate_series": { + "name": "default__generate_series", + "package_name": "dbt", + "path": "macros/utils/generate_series.sql", + "original_file_path": "macros/utils/generate_series.sql", + "unique_id": "macro.dbt.default__generate_series", + "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_powers_of_two" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_aggregate_function_create_replace_signature": { + "name": "default__get_aggregate_function_create_replace_signature", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.default__get_aggregate_function_create_replace_signature", + "macro_sql": "{% macro default__get_aggregate_function_create_replace_signature(target_relation) %}\n CREATE OR REPLACE AGGREGATE FUNCTION {{ target_relation.render() }} ({{ get_formatted_aggregate_function_args()}})\n RETURNS {{ model.returns.data_type }}\n {{ get_function_language_specifier() }}\n {{ get_aggregate_function_volatility_specifier() }}\n {% if model.get('language') == 'python' %}\n {{ get_function_python_options() }}\n {% endif %}\n AS\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_aggregate_function_volatility_specifier", + "macro.dbt.get_formatted_aggregate_function_args", + "macro.dbt.get_function_language_specifier", + "macro.dbt.get_function_python_options" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_aggregate_function_volatility_specifier": { + "name": "default__get_aggregate_function_volatility_specifier", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.default__get_aggregate_function_volatility_specifier", + "macro_sql": "{% macro default__get_aggregate_function_volatility_specifier() %}\n {{ scalar_function_volatility_sql() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.scalar_function_volatility_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_aggregated_test_sql": { + "name": "default__get_aggregated_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/aggregated_test.sql", + "original_file_path": "macros/materializations/tests/aggregated_test.sql", + "unique_id": "macro.dbt.default__get_aggregated_test_sql", + "macro_sql": "{% macro default__get_aggregated_test_sql(main_sql) -%}\n -- Process aggregated test results by column\n -- Expects the main_sql to return a column_name and a failures count per failing column\n with aggregated_data as (\n {{ main_sql }}\n )\n select\n column_name,\n sum(failures) as failures,\n sum(failures) > 0 as should_warn,\n sum(failures) > 0 as should_error\n from aggregated_data\n group by column_name\n order by column_name\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_alter_materialized_view_as_sql": { + "name": "default__get_alter_materialized_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/alter.sql", + "original_file_path": "macros/relations/materialized_view/alter.sql", + "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", + "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_assert_columns_equivalent": { + "name": "default__get_assert_columns_equivalent", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.default__get_assert_columns_equivalent", + "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.assert_columns_equivalent" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_batch_size": { + "name": "default__get_batch_size", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.default__get_batch_size", + "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_binding_char": { + "name": "default__get_binding_char", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.default__get_binding_char", + "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_catalog": { + "name": "default__get_catalog", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_catalog_for_single_relation": { + "name": "default__get_catalog_for_single_relation", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.default__get_catalog_for_single_relation", + "macro_sql": "{% macro default__get_catalog_for_single_relation(relation) %}\n {{ exceptions.raise_not_implemented(\n 'get_catalog_for_single_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_catalog_relations": { + "name": "default__get_catalog_relations", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.default__get_catalog_relations", + "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog_relations not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_column_names": { + "name": "default__get_column_names", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.default__get_column_names", + "macro_sql": "{% macro default__get_column_names() %}\n {#- loop through user_provided_columns to get column names -#}\n {%- set user_provided_columns = model['columns'] -%}\n {%- for i in user_provided_columns %}\n {%- set col = user_provided_columns[i] -%}\n {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_columns_in_query": { + "name": "default__get_columns_in_query", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 {{ get_empty_subquery_sql(select_sql) }}\n {% endcall %}\n {# DIVERGENCE: Fusion reads the original schema because Agate flattens nested columns. #}\n {{ return(load_result('get_columns_in_query').table.top_level_column_names) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_empty_subquery_sql", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_columns_in_relation": { + "name": "default__get_columns_in_relation", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_backup_sql": { + "name": "default__get_create_backup_sql", + "package_name": "dbt", + "path": "macros/relations/create_backup.sql", + "original_file_path": "macros/relations/create_backup.sql", + "unique_id": "macro.dbt.default__get_create_backup_sql", + "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n -- drop any pre-existing backup\n {{ get_drop_sql(backup_relation) }};\n\n {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_drop_sql", + "macro.dbt.get_rename_sql", + "macro.dbt.make_backup_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_index_sql": { + "name": "default__get_create_index_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.default__get_create_index_sql", + "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_intermediate_sql": { + "name": "default__get_create_intermediate_sql", + "package_name": "dbt", + "path": "macros/relations/create_intermediate.sql", + "original_file_path": "macros/relations/create_intermediate.sql", + "unique_id": "macro.dbt.default__get_create_intermediate_sql", + "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n -- drop any pre-existing intermediate\n {{ get_drop_sql(intermediate_relation) }};\n\n {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_sql", + "macro.dbt.get_drop_sql", + "macro.dbt.make_intermediate_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_materialized_view_as_sql": { + "name": "default__get_create_materialized_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/create.sql", + "original_file_path": "macros/relations/materialized_view/create.sql", + "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", + "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n {{ exceptions.raise_compiler_error(\n \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_sql": { + "name": "default__get_create_sql", + "package_name": "dbt", + "path": "macros/relations/create.sql", + "original_file_path": "macros/relations/create.sql", + "unique_id": "macro.dbt.default__get_create_sql", + "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n {%- if relation.is_view -%}\n {{ get_create_view_as_sql(relation, sql) }}\n\n {%- elif relation.is_table -%}\n {{ get_create_table_as_sql(False, relation, sql) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_materialized_view_as_sql", + "macro.dbt.get_create_table_as_sql", + "macro.dbt.get_create_view_as_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_table_as_sql": { + "name": "default__get_create_table_as_sql", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.create_table_as" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_create_view_as_sql": { + "name": "default__get_create_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/view/create.sql", + "original_file_path": "macros/relations/view/create.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.create_view_as" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_csv_sql": { + "name": "default__get_csv_sql", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.default__get_csv_sql", + "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ create_or_truncate_sql }};\n -- dbt seed --\n {{ insert_sql }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_dcl_statement_list": { + "name": "default__get_dcl_statement_list", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__get_dcl_statement_list", + "macro_sql": "{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n {#\n -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n #}\n {%- set dcl_statements = [] -%}\n {%- for privilege, grantees in grant_config.items() %}\n {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n {%- do dcl_statements.append(dcl) -%}\n {%- else -%}\n {%- for grantee in grantees -%}\n {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n {%- do dcl_statements.append(dcl) -%}\n {% endfor -%}\n {%- endif -%}\n {%- endfor -%}\n {{ return(dcl_statements) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.support_multiple_grantees_per_dcl_statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_delete_insert_merge_sql": { + "name": "default__get_delete_insert_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", + "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key %}\n {% if unique_key is string %}\n {% set unique_key = [unique_key] %}\n {% endif %}\n\n {%- set unique_key_str = unique_key|join(', ') -%}\n\n delete from {{ target }} as DBT_INTERNAL_DEST\n where ({{ unique_key_str }}) in (\n select distinct {{ unique_key_str }}\n from {{ source }} as DBT_INTERNAL_SOURCE\n )\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%};\n\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_drop_backup_sql": { + "name": "default__get_drop_backup_sql", + "package_name": "dbt", + "path": "macros/relations/drop_backup.sql", + "original_file_path": "macros/relations/drop_backup.sql", + "unique_id": "macro.dbt.default__get_drop_backup_sql", + "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_drop_sql", + "macro.dbt.make_backup_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_drop_index_sql": { + "name": "default__get_drop_index_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.default__get_drop_index_sql", + "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_drop_sql": { + "name": "default__get_drop_sql", + "package_name": "dbt", + "path": "macros/relations/drop.sql", + "original_file_path": "macros/relations/drop.sql", + "unique_id": "macro.dbt.default__get_drop_sql", + "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n {%- if relation.is_view -%}\n {{ drop_view(relation) }}\n\n {%- elif relation.is_table -%}\n {{ drop_table(relation) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ drop_materialized_view(relation) }}\n\n {%- else -%}\n drop {{ relation.type }} if exists {{ relation.render() }} cascade\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.drop_materialized_view", + "macro.dbt.drop_table", + "macro.dbt.drop_view" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_empty_schema_sql": { + "name": "default__get_empty_schema_sql", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.default__get_empty_schema_sql", + "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n {%- set col_err = [] -%}\n {%- set col_naked_numeric = [] -%}\n select\n {% for i in columns %}\n {%- set col = columns[i] -%}\n {%- if col['data_type'] is not defined -%}\n {%- do col_err.append(col['name']) -%}\n {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n {#-- TYPE CHECK: col['data_type'] is optional[string] but user have this constraint --#}\n {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n {%- do col_naked_numeric.append(col['name']) -%}\n {%- endif -%}\n {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n {{ cast('null', col['data_type']) }} as {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n {%- if (col_err | length) > 0 -%}\n {{ exceptions.column_type_missing(column_names=col_err) }}\n {%- elif (col_naked_numeric | length) > 0 -%}\n {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n {%- endif -%}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_empty_subquery_sql": { + "name": "default__get_empty_subquery_sql", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.default__get_empty_subquery_sql", + "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n {%- if select_sql_header is not none -%}\n {{ select_sql_header }}\n {%- endif -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_formatted_aggregate_function_args": { + "name": "default__get_formatted_aggregate_function_args", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.default__get_formatted_aggregate_function_args", + "macro_sql": "{% macro default__get_formatted_aggregate_function_args() %}\n {# conveniently we can reuse the sql scalar function args #}\n {{ formatted_scalar_function_args_sql() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.formatted_scalar_function_args_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_function_language_specifier": { + "name": "default__get_function_language_specifier", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.default__get_function_language_specifier", + "macro_sql": "{% macro default__get_function_language_specifier() %}\n {% set language = model.get('language') %}\n {% if language == 'sql' %}\n {# generally you dont need to specify the language for sql functions #}\n {% elif language == 'python' %}\n LANGUAGE PYTHON\n {% elif language == 'javascript' %}\n LANGUAGE js\n {% else %}\n {{ 'LANGUAGE ' ~ language.upper() }}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_function_macro": { + "name": "default__get_function_macro", + "package_name": "dbt", + "path": "macros/materializations/functions/helpers.sql", + "original_file_path": "macros/materializations/functions/helpers.sql", + "unique_id": "macro.dbt.default__get_function_macro", + "macro_sql": "{% macro default__get_function_macro(function_type, function_language) %}\n {% set macro_name = function_type ~ \"_function_\" ~ function_language %}\n {% if not macro_name in context %}\n {{ exceptions.raise_not_implemented(function_language ~ ' ' ~ function_type ~ ' function not implemented for adapter ' ~adapter.type()) }}\n {% endif %}\n {% set macro = context[macro_name] %}\n {{ return(macro) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_function_python_options": { + "name": "default__get_function_python_options", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.default__get_function_python_options", + "macro_sql": "{% macro default__get_function_python_options() %}\n RUNTIME_VERSION = '{{ model.config.get('runtime_version') }}'\n HANDLER = '{{ model.config.get('entry_point') }}'\n {% set packages = model.config.get('packages', []) %}\n {% if packages %}\n PACKAGES = ('{{ packages | join(\"','\") }}')\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_grant_sql": { + "name": "default__get_grant_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__get_grant_sql", + "macro_sql": "{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ privilege }} on {{ relation.render() }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_append_sql": { + "name": "default__get_incremental_append_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_append_sql", + "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_insert_into_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_default_sql": { + "name": "default__get_incremental_default_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_default_sql", + "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_incremental_append_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_delete_insert_sql": { + "name": "default__get_incremental_delete_insert_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", + "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_delete_insert_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_insert_overwrite_sql": { + "name": "default__get_incremental_insert_overwrite_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", + "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_insert_overwrite_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_merge_sql": { + "name": "default__get_incremental_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_merge_sql", + "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_incremental_microbatch_sql": { + "name": "default__get_incremental_microbatch_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.default__get_incremental_microbatch_sql", + "macro_sql": "{% macro default__get_incremental_microbatch_sql(arg_dict) %}\n\n {{ exceptions.raise_not_implemented('microbatch materialization strategy not implemented for adapter ' + adapter.type()) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_insert_overwrite_merge_sql": { + "name": "default__get_insert_overwrite_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", + "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {#-- The only time include_sql_header is True: --#}\n {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n {#-- We should consider including the sql header at the materialization level instead --#}\n\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_intervals_between": { + "name": "default__get_intervals_between", + "package_name": "dbt", + "path": "macros/utils/date_spine.sql", + "original_file_path": "macros/utils/date_spine.sql", + "unique_id": "macro.dbt.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.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.datediff", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_limit_sql": { + "name": "default__get_limit_sql", + "package_name": "dbt", + "path": "macros/adapters/show.sql", + "original_file_path": "macros/adapters/show.sql", + "unique_id": "macro.dbt.default__get_limit_sql", + "macro_sql": "{% macro default__get_limit_sql(sql, limit) %}\n {{ sql }}\n {% if limit is not none %}\n limit {{ limit }}\n {%- endif -%}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_materialized_view_configuration_changes": { + "name": "default__get_materialized_view_configuration_changes", + "package_name": "dbt", + "path": "macros/relations/materialized_view/alter.sql", + "original_file_path": "macros/relations/materialized_view/alter.sql", + "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", + "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_merge_sql": { + "name": "default__get_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.default__get_merge_sql", + "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set merge_update_columns = config.get('merge_update_columns') -%}\n {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n {% for key in unique_key %}\n {% set this_key_match %}\n DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n {% endset %}\n {% do predicates.append(this_key_match) %}\n {% endfor %}\n {% else %}\n {% set source_unique_key = (\"DBT_INTERNAL_SOURCE.\" ~ unique_key) | trim %}\n {% set target_unique_key = (\"DBT_INTERNAL_DEST.\" ~ unique_key) | trim %}\n {% set unique_key_match = get_merge_unique_key_match(source_unique_key, target_unique_key) %}\n {% do predicates.append(unique_key_match) %}\n {% endif %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_merge_unique_key_match", + "macro.dbt.get_merge_update_columns", + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_merge_unique_key_match": { + "name": "default__get_merge_unique_key_match", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.default__get_merge_unique_key_match", + "macro_sql": "{% macro default__get_merge_unique_key_match(source_unique_key, target_unique_key) -%}\n {{ return(equals(source_unique_key, target_unique_key) | trim) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.equals" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_merge_update_columns": { + "name": "default__get_merge_update_columns", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.default__get_merge_update_columns", + "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n {%- if merge_update_columns and merge_exclude_columns -%}\n {{ exceptions.raise_compiler_error(\n 'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n )}}\n {%- elif merge_update_columns -%}\n {%- set update_columns = merge_update_columns -%}\n {%- elif merge_exclude_columns -%}\n {%- set update_columns = [] -%}\n {%- for column in dest_columns -%}\n {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n {%- do update_columns.append(column.quoted) -%}\n {% endif %}\n {%- endfor -%}\n {%- else -%}\n {%- set update_columns = default_cols -%}\n {%- endif -%}\n\n {{ return(update_columns) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_or_create_relation": { + "name": "default__get_or_create_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_powers_of_two": { + "name": "default__get_powers_of_two", + "package_name": "dbt", + "path": "macros/utils/generate_series.sql", + "original_file_path": "macros/utils/generate_series.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_relation_last_modified": { + "name": "default__get_relation_last_modified", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.default__get_relation_last_modified", + "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n {{ exceptions.raise_not_implemented(\n 'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_relations": { + "name": "default__get_relations", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.default__get_relations", + "macro_sql": "{% macro default__get_relations() %}\n {{ exceptions.raise_not_implemented(\n 'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_relations_by_pattern_internal": { + "name": "default__get_relations_by_pattern_internal", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern.sql", + "original_file_path": "macros/relations/get_relations_by_pattern.sql", + "unique_id": "macro.dbt.default__get_relations_by_pattern_internal", + "macro_sql": "{% macro default__get_relations_by_pattern_internal(schema_pattern, table_pattern, exclude='', database=target.database, quote_table=False, excluded_schemas=[]) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ adapter.dispatch('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 {% if row.table_schema not in excluded_schemas %}\n {% if quote_table %}\n {% set table_name = '\"' ~ row.table_name ~ '\"' %}\n {% else %}\n {% set table_name = row.table_name %}\n {% endif %}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {% endif %}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt_utils.default__get_tables_by_pattern_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_rename_intermediate_sql": { + "name": "default__get_rename_intermediate_sql", + "package_name": "dbt", + "path": "macros/relations/rename_intermediate.sql", + "original_file_path": "macros/relations/rename_intermediate.sql", + "unique_id": "macro.dbt.default__get_rename_intermediate_sql", + "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_rename_sql", + "macro.dbt.make_intermediate_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_rename_materialized_view_sql": { + "name": "default__get_rename_materialized_view_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/rename.sql", + "original_file_path": "macros/relations/materialized_view/rename.sql", + "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", + "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_rename_sql": { + "name": "default__get_rename_sql", + "package_name": "dbt", + "path": "macros/relations/rename.sql", + "original_file_path": "macros/relations/rename.sql", + "unique_id": "macro.dbt.default__get_rename_sql", + "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n {%- if relation.is_view -%}\n {{ get_rename_view_sql(relation, new_name) }}\n\n {%- elif relation.is_table -%}\n {{ get_rename_table_sql(relation, new_name) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.get_rename_materialized_view_sql", + "macro.dbt.get_rename_table_sql", + "macro.dbt.get_rename_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_rename_table_sql": { + "name": "default__get_rename_table_sql", + "package_name": "dbt", + "path": "macros/relations/table/rename.sql", + "original_file_path": "macros/relations/table/rename.sql", + "unique_id": "macro.dbt.default__get_rename_table_sql", + "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_rename_view_sql": { + "name": "default__get_rename_view_sql", + "package_name": "dbt", + "path": "macros/relations/view/rename.sql", + "original_file_path": "macros/relations/view/rename.sql", + "unique_id": "macro.dbt.default__get_rename_view_sql", + "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_replace_materialized_view_sql": { + "name": "default__get_replace_materialized_view_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/replace.sql", + "original_file_path": "macros/relations/materialized_view/replace.sql", + "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", + "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_replace_sql": { + "name": "default__get_replace_sql", + "package_name": "dbt", + "path": "macros/relations/replace.sql", + "original_file_path": "macros/relations/replace.sql", + "unique_id": "macro.dbt.default__get_replace_sql", + "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {# /* use a create or replace statement if possible */ #}\n\n {% set is_replaceable = existing_relation.type == target_relation.type and existing_relation.can_be_replaced %}\n\n {% if is_replaceable and existing_relation.is_view %}\n {{ get_replace_view_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_table %}\n {{ get_replace_table_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_materialized_view %}\n {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n {%- elif target_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_drop_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }}\n\n {# /* create target_relation in place by first backing up the existing relation */ #}\n {%- elif existing_relation.can_be_renamed -%}\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* no renaming is allowed, so just drop and create */ #}\n {%- else -%}\n {{ get_drop_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }}\n\n {%- endif -%}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_backup_sql", + "macro.dbt.get_create_intermediate_sql", + "macro.dbt.get_create_sql", + "macro.dbt.get_drop_backup_sql", + "macro.dbt.get_drop_sql", + "macro.dbt.get_rename_intermediate_sql", + "macro.dbt.get_replace_materialized_view_sql", + "macro.dbt.get_replace_table_sql", + "macro.dbt.get_replace_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_replace_table_sql": { + "name": "default__get_replace_table_sql", + "package_name": "dbt", + "path": "macros/relations/table/replace.sql", + "original_file_path": "macros/relations/table/replace.sql", + "unique_id": "macro.dbt.default__get_replace_table_sql", + "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_replace_view_sql": { + "name": "default__get_replace_view_sql", + "package_name": "dbt", + "path": "macros/relations/view/replace.sql", + "original_file_path": "macros/relations/view/replace.sql", + "unique_id": "macro.dbt.default__get_replace_view_sql", + "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_revoke_sql": { + "name": "default__get_revoke_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__get_revoke_sql", + "macro_sql": "{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n {%- set quoted_grantees = [] -%}\n {%- for grantee in grantees -%}\n {%- do quoted_grantees.append(adapter.quote(grantee)) -%}\n {%- endfor -%}\n revoke {{ privilege }} on {{ relation.render() }} from {{ quoted_grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_select_subquery": { + "name": "default__get_select_subquery", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.default__get_select_subquery", + "macro_sql": "{% macro default__get_select_subquery(sql) %}\n select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n from (\n {{ sql }}\n ) as model_subq\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_column_names" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_show_grant_sql": { + "name": "default__get_show_grant_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__get_show_grant_sql", + "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n show grants on {{ relation.render() }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_show_indexes_sql": { + "name": "default__get_show_indexes_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.default__get_show_indexes_sql", + "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_table_columns_and_constraints": { + "name": "default__get_table_columns_and_constraints", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.default__get_table_columns_and_constraints", + "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.table_columns_and_constraints" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_table_types_sql": { + "name": "default__get_table_types_sql", + "package_name": "dbt", + "path": "macros/relations/get_table_types_sql.sql", + "original_file_path": "macros/relations/get_table_types_sql.sql", + "unique_id": "macro.dbt.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 {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_tables_by_pattern_sql": { + "name": "default__get_tables_by_pattern_sql", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern_sql.sql", + "original_file_path": "macros/relations/get_relations_by_pattern_sql.sql", + "unique_id": "macro.dbt.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 {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ adapter.dispatch('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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_test_sql": { + "name": "default__get_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/helpers.sql", + "original_file_path": "macros/materializations/tests/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_true_sql": { + "name": "default__get_true_sql", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.default__get_true_sql", + "macro_sql": "{% macro default__get_true_sql() %}\n {{ return('TRUE') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_unit_test_sql": { + "name": "default__get_unit_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/helpers.sql", + "original_file_path": "macros/materializations/tests/helpers.sql", + "unique_id": "macro.dbt.default__get_unit_test_sql", + "macro_sql": "{% macro default__get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n-- Build actual result given inputs\nwith dbt_internal_unit_test_actual as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%},{% endif %}{%- endfor -%}, {{ dbt.string_literal(\"actual\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ main_sql }}\n ) _dbt_internal_unit_test_actual\n),\n-- Build expected result\ndbt_internal_unit_test_expected as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%}, {% endif %}{%- endfor -%}, {{ dbt.string_literal(\"expected\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ expected_fixture_sql }}\n ) _dbt_internal_unit_test_expected\n)\n-- Union actual and expected results\nselect * from dbt_internal_unit_test_actual\nunion all\nselect * from dbt_internal_unit_test_expected\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.string_literal" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__get_where_subquery": { + "name": "default__get_where_subquery", + "package_name": "dbt", + "path": "macros/materializations/tests/where_subquery.sql", + "original_file_path": "macros/materializations/tests/where_subquery.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__handle_existing_table": { + "name": "default__handle_existing_table", + "package_name": "dbt", + "path": "macros/relations/view/replace.sql", + "original_file_path": "macros/relations/view/replace.sql", + "unique_id": "macro.dbt.default__handle_existing_table", + "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation.render() ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__hash": { + "name": "default__hash", + "package_name": "dbt", + "path": "macros/utils/hash.sql", + "original_file_path": "macros/utils/hash.sql", + "unique_id": "macro.dbt.default__hash", + "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__information_schema_name": { + "name": "default__information_schema_name", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__intersect": { + "name": "default__intersect", + "package_name": "dbt", + "path": "macros/utils/intersect.sql", + "original_file_path": "macros/utils/intersect.sql", + "unique_id": "macro.dbt.default__intersect", + "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__last_day": { + "name": "default__last_day", + "package_name": "dbt", + "path": "macros/utils/last_day.sql", + "original_file_path": "macros/utils/last_day.sql", + "unique_id": "macro.dbt.default__last_day", + "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default_last_day" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__length": { + "name": "default__length", + "package_name": "dbt", + "path": "macros/utils/length.sql", + "original_file_path": "macros/utils/length.sql", + "unique_id": "macro.dbt.default__length", + "macro_sql": "{% macro default__length(expression) %}\n\n length(\n {{ expression }}\n )\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__list_relations_without_caching": { + "name": "default__list_relations_without_caching", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__list_schemas": { + "name": "default__list_schemas", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.information_schema_name", + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__listagg": { + "name": "default__listagg", + "package_name": "dbt", + "path": "macros/utils/listagg.sql", + "original_file_path": "macros/utils/listagg.sql", + "unique_id": "macro.dbt.default__listagg", + "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__load_csv_rows": { + "name": "default__load_csv_rows", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_batch_size", + "macro.dbt.get_binding_char", + "macro.dbt.get_seed_column_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__make_backup_relation": { + "name": "default__make_backup_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.default__make_backup_relation", + "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n {%- set backup_relation = base_relation.incorporate(\n path={\"identifier\": backup_identifier},\n type=backup_relation_type\n ) -%}\n {{ return(backup_relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__make_intermediate_relation": { + "name": "default__make_intermediate_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.default__make_intermediate_relation", + "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__make_temp_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__make_temp_relation": { + "name": "default__make_temp_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.default__make_temp_relation", + "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n {%- set temp_relation = base_relation.incorporate(\n path={\"identifier\": temp_identifier}) -%}\n\n {{ return(temp_relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__persist_docs": { + "name": "default__persist_docs", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% set filtered_columns = validate_doc_columns(relation, model.columns, existing_columns) %}\n {% set alter_comment_sql = alter_column_comment(relation, filtered_columns) %}\n {% if alter_comment_sql and alter_comment_sql | trim | length > 0 %}\n {% do run_query(alter_comment_sql) %}\n {% endif %}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.alter_column_comment", + "macro.dbt.alter_relation_comment", + "macro.dbt.run_query", + "macro.dbt.validate_doc_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__position": { + "name": "default__position", + "package_name": "dbt", + "path": "macros/utils/position.sql", + "original_file_path": "macros/utils/position.sql", + "unique_id": "macro.dbt.default__position", + "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__post_snapshot": { + "name": "default__post_snapshot", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.default__post_snapshot", + "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__process_schema_changes": { + "name": "default__process_schema_changes", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.default__process_schema_changes", + "macro_sql": "{% macro default__process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }} -- noqa: return value should be list[base_column]\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\n Additional troubleshooting context:\n Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n New column types: {{ schema_changes_dict['new_target_types'] }}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.check_for_schema_changes", + "macro.dbt.sync_column_schemas" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__refresh_materialized_view": { + "name": "default__refresh_materialized_view", + "package_name": "dbt", + "path": "macros/relations/materialized_view/refresh.sql", + "original_file_path": "macros/relations/materialized_view/refresh.sql", + "unique_id": "macro.dbt.default__refresh_materialized_view", + "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__rename_relation": { + "name": "default__rename_relation", + "package_name": "dbt", + "path": "macros/relations/rename.sql", + "original_file_path": "macros/relations/rename.sql", + "unique_id": "macro.dbt.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.render() }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__replace": { + "name": "default__replace", + "package_name": "dbt", + "path": "macros/utils/replace.sql", + "original_file_path": "macros/utils/replace.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__reset_csv_table": { + "name": "default__reset_csv_table", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.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.render() %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.create_csv_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__resolve_model_name": { + "name": "default__resolve_model_name", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.default__resolve_model_name", + "macro_sql": "{%- macro default__resolve_model_name(input_model_name) -%}\n {{ input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__right": { + "name": "default__right", + "package_name": "dbt", + "path": "macros/utils/right.sql", + "original_file_path": "macros/utils/right.sql", + "unique_id": "macro.dbt.default__right", + "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__safe_cast": { + "name": "default__safe_cast", + "package_name": "dbt", + "path": "macros/utils/safe_cast.sql", + "original_file_path": "macros/utils/safe_cast.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__scalar_function_body_sql": { + "name": "default__scalar_function_body_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__scalar_function_body_sql", + "macro_sql": "{% macro default__scalar_function_body_sql() %}\n $$\n {{ model.compiled_code }}\n $$ LANGUAGE SQL\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__scalar_function_create_replace_signature_sql": { + "name": "default__scalar_function_create_replace_signature_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__scalar_function_create_replace_signature_sql", + "macro_sql": "{% macro default__scalar_function_create_replace_signature_sql(target_relation) %}\n CREATE OR REPLACE FUNCTION {{ target_relation.render() }} ({{ formatted_scalar_function_args_sql()}})\n RETURNS {{ model.returns.data_type }}\n {{ scalar_function_volatility_sql() }}\n AS\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.formatted_scalar_function_args_sql", + "macro.dbt.scalar_function_volatility_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__scalar_function_sql": { + "name": "default__scalar_function_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__scalar_function_sql", + "macro_sql": "{% macro default__scalar_function_sql(target_relation) %}\n {{ scalar_function_create_replace_signature_sql(target_relation) }}\n {{ scalar_function_body_sql() }};\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.scalar_function_body_sql", + "macro.dbt.scalar_function_create_replace_signature_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__scalar_function_volatility_javascript": { + "name": "default__scalar_function_volatility_javascript", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__scalar_function_volatility_javascript", + "macro_sql": "{% macro default__scalar_function_volatility_javascript() %}\n {% set volatility = model.config.get('volatility') %}\n {% if volatility != none %}\n {% set msg = \"Volatility is not supported by \" ~ adapter.type() ~ \" in javascript UDF and will be ignored\" %}\n {% do exceptions.warn(msg) %}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__scalar_function_volatility_sql": { + "name": "default__scalar_function_volatility_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__scalar_function_volatility_sql", + "macro_sql": "{% macro default__scalar_function_volatility_sql() %}\n {% set volatility = model.config.get('volatility') %}\n {% if volatility == 'deterministic' %}\n IMMUTABLE\n {% elif volatility == 'stable' %}\n STABLE\n {% elif volatility == 'non-deterministic' %}\n VOLATILE\n {% elif volatility != none %}\n {# This shouldn't happen unless a new volatility is invented #}\n {% do unsupported_volatility_warning(volatility) %}\n {% endif %}\n {# If no volatility is set, don't add anything and let the data warehouse default it #}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.unsupported_volatility_warning" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_check_column_exists": { + "name": "default__snapshot_check_column_exists", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.default__snapshot_check_column_exists", + "macro_sql": "{% macro default__snapshot_check_column_exists(column_name, existing_columns) -%}\n {{ return(column_name in existing_columns) }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_get_time": { + "name": "default__snapshot_get_time", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.default__snapshot_get_time", + "macro_sql": "{% macro default__snapshot_get_time() %}\n {{ current_timestamp() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_hash_arguments": { + "name": "default__snapshot_hash_arguments", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_merge_sql": { + "name": "default__snapshot_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/snapshots/snapshot_merge.sql", + "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", + "unique_id": "macro.dbt.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 {%- set columns = config.get(\"snapshot_table_column_names\") or get_snapshot_table_column_names() -%}\n\n merge into {{ target.render() }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }} = DBT_INTERNAL_DEST.{{ columns.dbt_scd_id }}\n\n when matched\n {% if config.get(\"dbt_valid_to_current\") %}\n\t{% set source_unique_key = (\"DBT_INTERNAL_DEST.\" ~ columns.dbt_valid_to) | trim %}\n\t{% set target_unique_key = config.get('dbt_valid_to_current') | trim %}\n\tand ({{ equals(source_unique_key, target_unique_key) }} or {{ source_unique_key }} is null)\n\n {% else %}\n and DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null\n {% endif %}\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set {{ columns.dbt_valid_to }} = DBT_INTERNAL_SOURCE.{{ columns.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.equals", + "macro.dbt.get_snapshot_table_column_names" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_staging_table": { + "name": "default__snapshot_staging_table", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.default__snapshot_staging_table", + "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {% set columns = config.get('snapshot_table_column_names') or get_snapshot_table_column_names() %}\n {% if strategy.hard_deletes == 'new_record' %}\n {% set new_scd_id = snapshot_hash_arguments([columns.dbt_scd_id, snapshot_get_time()]) %}\n {% endif %}\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *, {{ unique_key_fields(strategy.unique_key) }}\n from {{ target_relation }}\n where\n {% if config.get('dbt_valid_to_current') %}\n\t\t{% set source_unique_key = columns.dbt_valid_to | trim %}\n\t\t{% set target_unique_key = config.get('dbt_valid_to_current') | trim %} -- noqa: optional[string] does not support trim\n\n\t\t{# The exact equals semantics between NULL values depends on the current behavior flag set. Also, update records if the source field is null #}\n ( {{ equals(source_unique_key, target_unique_key) }} or {{ source_unique_key }} is null )\n {% else %}\n {{ columns.dbt_valid_to }} is null\n {% endif %}\n\n ),\n\n insertions_source_data as (\n\n select *, {{ unique_key_fields(strategy.unique_key) }},\n {{ strategy.updated_at }} as {{ columns.dbt_updated_at }},\n {{ strategy.updated_at }} as {{ columns.dbt_valid_from }},\n {{ get_dbt_valid_to_current(strategy, columns) }},\n {{ strategy.scd_id }} as {{ columns.dbt_scd_id }}\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select *, {{ unique_key_fields(strategy.unique_key) }},\n {{ strategy.updated_at }} as {{ columns.dbt_updated_at }},\n {{ strategy.updated_at }} as {{ columns.dbt_valid_from }},\n {{ strategy.updated_at }} as {{ columns.dbt_valid_to }}\n\n from snapshot_query\n ),\n\n {%- if strategy.hard_deletes == 'invalidate' or strategy.hard_deletes == 'new_record' %}\n\n deletes_source_data as (\n\n select *, {{ unique_key_fields(strategy.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 {%- if strategy.hard_deletes == 'new_record' -%}\n ,'False' as {{ columns.dbt_is_deleted }}\n {%- endif %}\n\n from insertions_source_data as source_data\n left outer join snapshotted_data\n on {{ unique_key_join_on(strategy.unique_key, \"snapshotted_data\", \"source_data\") }}\n where {{ unique_key_is_null(strategy.unique_key, \"snapshotted_data\") }}\n or ({{ unique_key_is_not_null(strategy.unique_key, \"snapshotted_data\") }} and (\n {{ strategy.row_changed }} {%- if strategy.hard_deletes == 'new_record' -%} or snapshotted_data.{{ columns.dbt_is_deleted }} = 'True' {% endif %}\n )\n\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.{{ columns.dbt_scd_id }}\n {%- if strategy.hard_deletes == 'new_record' -%}\n , snapshotted_data.{{ columns.dbt_is_deleted }}\n {%- endif %}\n\n from updates_source_data as source_data\n join snapshotted_data\n on {{ unique_key_join_on(strategy.unique_key, \"snapshotted_data\", \"source_data\") }}\n where (\n {{ strategy.row_changed }} {%- if strategy.hard_deletes == 'new_record' -%} or snapshotted_data.{{ columns.dbt_is_deleted }} = 'True' {% endif %}\n )\n )\n\n {%- if strategy.hard_deletes == 'invalidate' or strategy.hard_deletes == 'new_record' %}\n ,\n deletes as (\n\n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as {{ columns.dbt_valid_from }},\n {{ snapshot_get_time() }} as {{ columns.dbt_updated_at }},\n {{ snapshot_get_time() }} as {{ columns.dbt_valid_to }},\n snapshotted_data.{{ columns.dbt_scd_id }}\n {%- if strategy.hard_deletes == 'new_record' -%}\n , snapshotted_data.{{ columns.dbt_is_deleted }}\n {%- endif %}\n from snapshotted_data\n left join deletes_source_data as source_data\n on {{ unique_key_join_on(strategy.unique_key, \"snapshotted_data\", \"source_data\") }}\n where {{ unique_key_is_null(strategy.unique_key, \"source_data\") }}\n\n {%- if strategy.hard_deletes == 'new_record' %}\n and not (\n --avoid updating the record's valid_to if the latest entry is marked as deleted\n snapshotted_data.{{ columns.dbt_is_deleted }} = 'True'\n and\n {% if config.get('dbt_valid_to_current') -%}\n snapshotted_data.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }}\n {%- else -%}\n snapshotted_data.{{ columns.dbt_valid_to }} is null\n {%- endif %}\n )\n {%- endif %}\n )\n {%- endif %}\n\n {%- if strategy.hard_deletes == 'new_record' %}\n {% set snapshotted_cols = get_list_of_column_names(get_columns_in_relation(target_relation)) %}\n {% set source_col_names = get_columns_in_query(source_sql) %}\n ,\n deletion_records as (\n\n select\n 'insert' as dbt_change_type,\n {%- for col_name in source_col_names -%}\n {%- if col_name in snapshotted_cols -%}\n snapshotted_data.{{ adapter.quote(col_name) }},\n {%- else -%}\n source_data.{{ adapter.quote(col_name) }},\n {%- endif -%}\n {% endfor -%}\n {%- if strategy.unique_key | is_list -%}\n {%- for key in strategy.unique_key -%}\n snapshotted_data.{{ key }} as dbt_unique_key_{{ loop.index }},\n {% endfor -%}\n {%- else -%}\n snapshotted_data.dbt_unique_key as dbt_unique_key,\n {% endif -%}\n {{ snapshot_get_time() }} as {{ columns.dbt_valid_from }},\n {{ snapshot_get_time() }} as {{ columns.dbt_updated_at }},\n snapshotted_data.{{ columns.dbt_valid_to }} as {{ columns.dbt_valid_to }},\n {{ new_scd_id }} as {{ columns.dbt_scd_id }},\n 'True' as {{ columns.dbt_is_deleted }}\n from snapshotted_data\n left join deletes_source_data as source_data\n on {{ unique_key_join_on(strategy.unique_key, \"snapshotted_data\", \"source_data\") }}\n where {{ unique_key_is_null(strategy.unique_key, \"source_data\") }}\n and not (\n --avoid inserting a new record if the latest one is marked as deleted\n snapshotted_data.{{ columns.dbt_is_deleted }} = 'True'\n and\n {% if config.get('dbt_valid_to_current') -%}\n snapshotted_data.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }}\n {%- else -%}\n snapshotted_data.{{ columns.dbt_valid_to }} is null\n {%- endif %}\n )\n\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.hard_deletes == 'invalidate' or strategy.hard_deletes == 'new_record' %}\n union all\n select * from deletes\n {%- endif %}\n {%- if strategy.hard_deletes == 'new_record' %}\n union all\n select * from deletion_records\n {%- endif %}\n\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.equals", + "macro.dbt.get_columns_in_relation", + "macro.dbt.get_dbt_valid_to_current", + "macro.dbt.get_list_of_column_names", + "macro.dbt.get_snapshot_table_column_names", + "macro.dbt.snapshot_hash_arguments", + "macro.dbt.unique_key_fields", + "macro.dbt.unique_key_is_not_null", + "macro.dbt.unique_key_is_null", + "macro.dbt.unique_key_join_on" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__snapshot_string_as_time": { + "name": "default__snapshot_string_as_time", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__split_part": { + "name": "default__split_part", + "package_name": "dbt", + "path": "macros/utils/split_part.sql", + "original_file_path": "macros/utils/split_part.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__string_literal": { + "name": "default__string_literal", + "package_name": "dbt", + "path": "macros/utils/literal.sql", + "original_file_path": "macros/utils/literal.sql", + "unique_id": "macro.dbt.default__string_literal", + "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__support_multiple_grantees_per_dcl_statement": { + "name": "default__support_multiple_grantees_per_dcl_statement", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", + "macro_sql": "{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(True) }}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__sync_column_schemas": { + "name": "default__sync_column_schemas", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.default__sync_column_schemas", + "macro_sql": "{% macro default__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 {%- 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 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\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.alter_column_type", + "macro.dbt.alter_relation_add_remove_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__t_database_name": { + "name": "default__t_database_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.default__t_database_name", + "macro_sql": "{% macro default__t_database_name() %}\n {{ return(env_var('DBT_DB_NAME')) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_accepted_values": { + "name": "default__test_accepted_values", + "package_name": "dbt", + "path": "macros/generic_test_sql/accepted_values.sql", + "original_file_path": "macros/generic_test_sql/accepted_values.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_aggregated_not_null": { + "name": "default__test_aggregated_not_null", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_not_null.sql", + "original_file_path": "macros/generic_test_sql/aggregated_not_null.sql", + "unique_id": "macro.dbt.default__test_aggregated_not_null", + "macro_sql": "{% macro default__test_aggregated_not_null(model, column_names) %}\n{% set skip_column_names = aggregated_test_skip_column_names | default([]) %}\n{% set filtered_columns = [] %}\n\n{% for column_name in column_names %}\n {% if column_name not in skip_column_names %}\n {% do filtered_columns.append(column_name) %}\n {% endif %}\n{% endfor %}\n{#- One scan of the model produces every column's null count; the cross join then\n pivots those counts into one row per tested column. #}\n{%- if filtered_columns -%}\nselect\n column_name,\n failures\nfrom (\n select\n test_columns.column_name as column_name,\n case test_columns.column_name\n {%- for column_name in filtered_columns %}\n when {{ dbt.string_literal(column_name) }} then null_counts.failures_{{ loop.index0 }}\n {%- endfor %}\n end as failures\n from (\n select\n {%- for column_name in filtered_columns %}\n count(*) - count({{ column_name }}) as failures_{{ loop.index0 }}{{ \",\" if not loop.last }}\n {%- endfor %}\n from {{ model }}\n ) null_counts\n cross join (\n {%- for column_name in filtered_columns %}\n select {{ dbt.string_literal(column_name) }} as column_name\n {%- if not loop.last %}\n union all\n {%- endif %}\n {%- endfor %}\n ) test_columns\n) results\nwhere failures > 0\norder by column_name\n{%- else -%}\nselect\n cast(null as {{ dbt.type_string() }}) as column_name,\n cast(null as {{ dbt.type_int() }}) as failures\nwhere 1=0\n{%- endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.string_literal", + "macro.dbt.type_int", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_aggregated_unique": { + "name": "default__test_aggregated_unique", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_unique.sql", + "original_file_path": "macros/generic_test_sql/aggregated_unique.sql", + "unique_id": "macro.dbt.default__test_aggregated_unique", + "macro_sql": "{% macro default__test_aggregated_unique(model, column_names) %}\n\n{% set skip_column_names = aggregated_test_skip_column_names | default([]) %}\n\n{% set filtered_columns = [] %}\n\n{% for column_name in column_names %}\n {% if column_name not in skip_column_names %}\n {% do filtered_columns.append(column_name) %}\n {% endif %}\n{% endfor %}\n\n{% set union_queries = [] %}\n\n{#- Each duplicated value is one failure. #}\n{% for column_name in filtered_columns %}\n {% set query %}\n select\n {{ dbt.string_literal(column_name) }} as column_name,\n {{ dbt.aggregated_unique_field(column_name) }} as unique_field,\n count(*) as n_records,\n 1 as failures\n from {{ model }}\n where {{ column_name }} is not null\n group by {{ column_name }}\n having count(*) > 1\n {% endset %}\n\n {% do union_queries.append(query) %}\n{% endfor %}\n\n{% if union_queries %}\n {{ union_queries | join('\\nunion all\\n') }}\n order by column_name, n_records desc\n{% else %}\n select\n cast(null as {{ dbt.type_string() }}) as column_name,\n cast(null as {{ dbt.type_string() }}) as unique_field,\n cast(null as {{ dbt.type_int() }}) as n_records,\n cast(null as {{ dbt.type_int() }}) as failures\n where 1=0\n{% endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.aggregated_unique_field", + "macro.dbt.string_literal", + "macro.dbt.type_int", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_not_null": { + "name": "default__test_not_null", + "package_name": "dbt", + "path": "macros/generic_test_sql/not_null.sql", + "original_file_path": "macros/generic_test_sql/not_null.sql", + "unique_id": "macro.dbt.default__test_not_null", + "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.should_store_failures" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_relationships": { + "name": "default__test_relationships", + "package_name": "dbt", + "path": "macros/generic_test_sql/relationships.sql", + "original_file_path": "macros/generic_test_sql/relationships.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__test_unique": { + "name": "default__test_unique", + "package_name": "dbt", + "path": "macros/generic_test_sql/unique.sql", + "original_file_path": "macros/generic_test_sql/unique.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__truncate_relation": { + "name": "default__truncate_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.default__truncate_relation", + "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation.render() }}\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_bigint": { + "name": "default__type_bigint", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_bigint", + "macro_sql": "{% macro default__type_bigint() %}\n {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_boolean": { + "name": "default__type_boolean", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_boolean", + "macro_sql": "{%- macro default__type_boolean() -%}\n {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_float": { + "name": "default__type_float", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_float", + "macro_sql": "{% macro default__type_float() %}\n {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_int": { + "name": "default__type_int", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_int", + "macro_sql": "{%- macro default__type_int() -%}\n {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_numeric": { + "name": "default__type_numeric", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_numeric", + "macro_sql": "{% macro default__type_numeric() %}\n {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }} -- noqa: this warning is in the comment\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_string": { + "name": "default__type_string", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_string", + "macro_sql": "{% macro default__type_string() %}\n {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__type_timestamp": { + "name": "default__type_timestamp", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.default__type_timestamp", + "macro_sql": "{% macro default__type_timestamp() %}\n {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__unsupported_volatility_warning": { + "name": "default__unsupported_volatility_warning", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.default__unsupported_volatility_warning", + "macro_sql": "{% macro default__unsupported_volatility_warning(volatility) %}\n {% set msg = \"Found `\" ~ volatility ~ \"` volatility specified on function `\" ~ model.name ~ \"`. This volatility is not supported by \" ~ adapter.type() ~ \", and will be ignored\" %}\n {% do exceptions.warn(msg) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__validate_fixture_rows": { + "name": "default__validate_fixture_rows", + "package_name": "dbt", + "path": "macros/unit_test_sql/get_fixture_sql.sql", + "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", + "unique_id": "macro.dbt.default__validate_fixture_rows", + "macro_sql": "{%- macro default__validate_fixture_rows(rows, row_number) -%}\n {# This is an abstract method for adapter overrides as needed #}\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default__validate_sql": { + "name": "default__validate_sql", + "package_name": "dbt", + "path": "macros/adapters/validate_sql.sql", + "original_file_path": "macros/adapters/validate_sql.sql", + "unique_id": "macro.dbt.default__validate_sql", + "macro_sql": "{% macro default__validate_sql(sql) -%}\n {% call statement('validate_sql') -%}\n explain {{ sql }}\n {% endcall %}\n {{ return(load_result('validate_sql')) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.default_last_day": { + "name": "default_last_day", + "package_name": "dbt", + "path": "macros/utils/last_day.sql", + "original_file_path": "macros/utils/last_day.sql", + "unique_id": "macro.dbt.default_last_day", + "macro_sql": "{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt.dateadd('day', '-1',\n dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.date_trunc", + "macro.dbt.dateadd" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.diff_column_data_types": { + "name": "diff_column_data_types", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.diff_column_data_types", + "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n {{ return(adapter.dispatch('diff_column_data_types', 'dbt')(source_columns, target_columns)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__diff_column_data_types" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.diff_columns": { + "name": "diff_columns", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_materialized_view": { + "name": "drop_materialized_view", + "package_name": "dbt", + "path": "macros/relations/materialized_view/drop.sql", + "original_file_path": "macros/relations/materialized_view/drop.sql", + "unique_id": "macro.dbt.drop_materialized_view", + "macro_sql": "{% macro drop_materialized_view(relation) -%}\n {{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__drop_materialized_view" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_relation": { + "name": "drop_relation", + "package_name": "dbt", + "path": "macros/relations/drop.sql", + "original_file_path": "macros/relations/drop.sql", + "unique_id": "macro.dbt.drop_relation", + "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__drop_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_relation_if_exists": { + "name": "drop_relation_if_exists", + "package_name": "dbt", + "path": "macros/relations/drop.sql", + "original_file_path": "macros/relations/drop.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_schema": { + "name": "drop_schema", + "package_name": "dbt", + "path": "macros/adapters/schema.sql", + "original_file_path": "macros/adapters/schema.sql", + "unique_id": "macro.dbt.drop_schema", + "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__drop_schema" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_schema_named": { + "name": "drop_schema_named", + "package_name": "dbt", + "path": "macros/relations/schema.sql", + "original_file_path": "macros/relations/schema.sql", + "unique_id": "macro.dbt.drop_schema_named", + "macro_sql": "{% macro drop_schema_named(schema_name) %}\n {{ return(adapter.dispatch('drop_schema_named', 'dbt') (schema_name)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__drop_schema_named" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_table": { + "name": "drop_table", + "package_name": "dbt", + "path": "macros/relations/table/drop.sql", + "original_file_path": "macros/relations/table/drop.sql", + "unique_id": "macro.dbt.drop_table", + "macro_sql": "{% macro drop_table(relation) -%}\n {{- adapter.dispatch('drop_table', 'dbt')(relation) -}}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__drop_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.drop_view": { + "name": "drop_view", + "package_name": "dbt", + "path": "macros/relations/view/drop.sql", + "original_file_path": "macros/relations/view/drop.sql", + "unique_id": "macro.dbt.drop_view", + "macro_sql": "{% macro drop_view(relation) -%}\n {{- adapter.dispatch('drop_view', 'dbt')(relation) -}}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__drop_view" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.equals": { + "name": "equals", + "package_name": "dbt", + "path": "macros/utils/equals.sql", + "original_file_path": "macros/utils/equals.sql", + "unique_id": "macro.dbt.equals", + "macro_sql": "{% macro equals(expr1, expr2) %}\n {{ return(adapter.dispatch('equals', 'dbt') (expr1, expr2)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__equals" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.escape_single_quotes": { + "name": "escape_single_quotes", + "package_name": "dbt", + "path": "macros/utils/escape_single_quotes.sql", + "original_file_path": "macros/utils/escape_single_quotes.sql", + "unique_id": "macro.dbt.escape_single_quotes", + "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__escape_single_quotes" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.except": { + "name": "except", + "package_name": "dbt", + "path": "macros/utils/except.sql", + "original_file_path": "macros/utils/except.sql", + "unique_id": "macro.dbt.except", + "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__except" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.format_columns": { + "name": "format_columns", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.format_columns", + "macro_sql": "{% macro format_columns(columns) %}\n {% set formatted_columns = [] %}\n {% for column in columns %}\n {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n {%- do formatted_columns.append(formatted_column) -%}\n {% endfor %}\n {{ return(formatted_columns) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__format_column" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.format_row": { + "name": "format_row", + "package_name": "dbt", + "path": "macros/unit_test_sql/get_fixture_sql.sql", + "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", + "unique_id": "macro.dbt.format_row", + "macro_sql": "{%- macro format_row(row, column_name_to_data_types) -%}\n {#-- generate case-insensitive formatted row --#}\n {% set formatted_row = {} %}\n {%- for column_name, column_value in row.items() -%}\n {% set column_name = column_name|lower %}\n\n {%- if column_name not in column_name_to_data_types %}\n {#-- if user-provided row contains column name that relation does not contain, raise an error --#}\n {% set fixture_name = \"expected output\" if model.resource_type == 'unit_test' else (\"'\" ~ model.name ~ \"'\") %}\n {{ exceptions.raise_compiler_error(\n \"Invalid column name: '\" ~ column_name ~ \"' in unit test fixture for \" ~ fixture_name ~ \".\"\n \"\\nAccepted columns for \" ~ fixture_name ~ \" are: \" ~ (column_name_to_data_types.keys()|list)\n ) }}\n {%- endif -%}\n\n {%- set column_type = column_name_to_data_types[column_name] %}\n\n {#-- sanitize column_value: wrap yaml strings in quotes, apply cast --#}\n {%- set column_value_clean = column_value -%}\n {%- if column_value is string -%}\n {%- set column_value_clean = dbt.string_literal(dbt.escape_single_quotes(column_value)) -%}\n {%- elif column_value is none -%}\n {%- set column_value_clean = 'null' -%}\n {%- endif -%}\n\n {%- set row_update = {column_name: safe_cast(column_value_clean, column_type) } -%}\n {%- do formatted_row.update(row_update) -%}\n {%- endfor -%}\n {{ return(formatted_row) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.escape_single_quotes", + "macro.dbt.safe_cast", + "macro.dbt.string_literal" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.formatted_scalar_function_args_javascript": { + "name": "formatted_scalar_function_args_javascript", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.formatted_scalar_function_args_javascript", + "macro_sql": "{% macro formatted_scalar_function_args_javascript() %}\n {{ return(adapter.dispatch('formatted_scalar_function_args_javascript', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__formatted_scalar_function_args_javascript" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.formatted_scalar_function_args_sql": { + "name": "formatted_scalar_function_args_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.formatted_scalar_function_args_sql", + "macro_sql": "{% macro formatted_scalar_function_args_sql() %}\n {{ return(adapter.dispatch('formatted_scalar_function_args_sql', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__formatted_scalar_function_args_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.function_execute_build_sql": { + "name": "function_execute_build_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/helpers.sql", + "original_file_path": "macros/materializations/functions/helpers.sql", + "unique_id": "macro.dbt.function_execute_build_sql", + "macro_sql": "{% macro function_execute_build_sql(build_sql, existing_relation, target_relation) %}\n {{ return(adapter.dispatch('function_execute_build_sql', 'dbt')(build_sql, existing_relation, target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__function_execute_build_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_alias_name": { + "name": "generate_alias_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_alias.sql", + "original_file_path": "macros/get_custom_name/get_custom_alias.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__generate_alias_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_database_name": { + "name": "generate_database_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_database.sql", + "original_file_path": "macros/get_custom_name/get_custom_database.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__generate_database_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_latest_version_pointer_alias": { + "name": "generate_latest_version_pointer_alias", + "package_name": "dbt", + "path": "macros/get_custom_name/get_latest_version_pointer_alias.sql", + "original_file_path": "macros/get_custom_name/get_latest_version_pointer_alias.sql", + "unique_id": "macro.dbt.generate_latest_version_pointer_alias", + "macro_sql": "{% macro generate_latest_version_pointer_alias(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_latest_version_pointer_alias', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__generate_latest_version_pointer_alias" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_schema_name": { + "name": "generate_schema_name", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_schema.sql", + "original_file_path": "macros/get_custom_name/get_custom_schema.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__generate_schema_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_schema_name_for_env": { + "name": "generate_schema_name_for_env", + "package_name": "dbt", + "path": "macros/get_custom_name/get_custom_schema.sql", + "original_file_path": "macros/get_custom_name/get_custom_schema.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.generate_series": { + "name": "generate_series", + "package_name": "dbt", + "path": "macros/utils/generate_series.sql", + "original_file_path": "macros/utils/generate_series.sql", + "unique_id": "macro.dbt.generate_series", + "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__generate_series" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_aggregate_function_create_replace_signature": { + "name": "get_aggregate_function_create_replace_signature", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.get_aggregate_function_create_replace_signature", + "macro_sql": "{% macro get_aggregate_function_create_replace_signature(target_relation) %}\n {{ return(adapter.dispatch('get_aggregate_function_create_replace_signature', 'dbt')(target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_aggregate_function_create_replace_signature" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_aggregate_function_volatility_specifier": { + "name": "get_aggregate_function_volatility_specifier", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.get_aggregate_function_volatility_specifier", + "macro_sql": "{% macro get_aggregate_function_volatility_specifier() %}\n {{ return(adapter.dispatch('get_aggregate_function_volatility_specifier', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_aggregate_function_volatility_specifier" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_aggregated_test_sql": { + "name": "get_aggregated_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/aggregated_test.sql", + "original_file_path": "macros/materializations/tests/aggregated_test.sql", + "unique_id": "macro.dbt.get_aggregated_test_sql", + "macro_sql": "{% macro get_aggregated_test_sql(main_sql) -%}\n {{ adapter.dispatch('get_aggregated_test_sql', 'dbt')(main_sql) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_aggregated_test_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_alter_materialized_view_as_sql": { + "name": "get_alter_materialized_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/alter.sql", + "original_file_path": "macros/relations/materialized_view/alter.sql", + "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", + "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{- log('Applying ALTER to: ' ~ relation) -}}\n {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n ) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_alter_materialized_view_as_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_assert_columns_equivalent": { + "name": "get_assert_columns_equivalent", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.get_assert_columns_equivalent", + "macro_sql": "{%- macro get_assert_columns_equivalent(sql) -%}\n {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_assert_columns_equivalent" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_batch_size": { + "name": "get_batch_size", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.get_batch_size", + "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_batch_size" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_binding_char": { + "name": "get_binding_char", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.get_binding_char", + "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_binding_char" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_catalog": { + "name": "get_catalog", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.get_catalog", + "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_catalog" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_catalog_for_single_relation": { + "name": "get_catalog_for_single_relation", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.get_catalog_for_single_relation", + "macro_sql": "{% macro get_catalog_for_single_relation(relation) %}\n {{ return(adapter.dispatch('get_catalog_for_single_relation', 'dbt')(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_catalog_for_single_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_catalog_relations": { + "name": "get_catalog_relations", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.get_catalog_relations", + "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_catalog_relations" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_column_schema_from_query": { + "name": "get_column_schema_from_query", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.get_column_schema_from_query", + "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n {% set columns = [] %}\n {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n {{ return(column_schema) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_empty_subquery_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_columns_in_query": { + "name": "get_columns_in_query", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_columns_in_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_columns_in_relation": { + "name": "get_columns_in_relation", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.get_columns_in_relation", + "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_backup_sql": { + "name": "get_create_backup_sql", + "package_name": "dbt", + "path": "macros/relations/create_backup.sql", + "original_file_path": "macros/relations/create_backup.sql", + "unique_id": "macro.dbt.get_create_backup_sql", + "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_backup_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_index_sql": { + "name": "get_create_index_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_create_index_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_intermediate_sql": { + "name": "get_create_intermediate_sql", + "package_name": "dbt", + "path": "macros/relations/create_intermediate.sql", + "original_file_path": "macros/relations/create_intermediate.sql", + "unique_id": "macro.dbt.get_create_intermediate_sql", + "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_intermediate_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_materialized_view_as_sql": { + "name": "get_create_materialized_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/create.sql", + "original_file_path": "macros/relations/materialized_view/create.sql", + "unique_id": "macro.dbt.get_create_materialized_view_as_sql", + "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_materialized_view_as_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_sql": { + "name": "get_create_sql", + "package_name": "dbt", + "path": "macros/relations/create.sql", + "original_file_path": "macros/relations/create.sql", + "unique_id": "macro.dbt.get_create_sql", + "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n {{- log('Applying CREATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_table_as_sql": { + "name": "get_create_table_as_sql", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_table_as_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_create_view_as_sql": { + "name": "get_create_view_as_sql", + "package_name": "dbt", + "path": "macros/relations/view/create.sql", + "original_file_path": "macros/relations/view/create.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_create_view_as_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_csv_sql": { + "name": "get_csv_sql", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.get_csv_sql", + "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_csv_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_dbt_valid_to_current": { + "name": "get_dbt_valid_to_current", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.get_dbt_valid_to_current", + "macro_sql": "{% macro get_dbt_valid_to_current(strategy, columns) %}\n {% set dbt_valid_to_current = config.get('dbt_valid_to_current') or \"null\" %}\n coalesce(nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}), {{dbt_valid_to_current}})\n as {{ columns.dbt_valid_to }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_dcl_statement_list": { + "name": "get_dcl_statement_list", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.get_dcl_statement_list", + "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_dcl_statement_list" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_delete_insert_merge_sql": { + "name": "get_delete_insert_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.get_delete_insert_merge_sql", + "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_delete_insert_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_drop_backup_sql": { + "name": "get_drop_backup_sql", + "package_name": "dbt", + "path": "macros/relations/drop_backup.sql", + "original_file_path": "macros/relations/drop_backup.sql", + "unique_id": "macro.dbt.get_drop_backup_sql", + "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_drop_backup_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_drop_index_sql": { + "name": "get_drop_index_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.get_drop_index_sql", + "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_drop_index_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_drop_sql": { + "name": "get_drop_sql", + "package_name": "dbt", + "path": "macros/relations/drop.sql", + "original_file_path": "macros/relations/drop.sql", + "unique_id": "macro.dbt.get_drop_sql", + "macro_sql": "{%- macro get_drop_sql(relation) -%}\n {{- log('Applying DROP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_drop_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_empty_schema_sql": { + "name": "get_empty_schema_sql", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.get_empty_schema_sql", + "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_empty_schema_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_empty_subquery_sql": { + "name": "get_empty_subquery_sql", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.get_empty_subquery_sql", + "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n {#-- DIVERGENCE BEGIN: strip a terminal `;` so it does not land inside the\n wrapper built below; done at the dispatcher so the adapter overrides are\n covered too. See `StmtSplitter::strip_trailing_statement_terminator`.\n Upstream: https://github.com/dbt-labs/dbt-adapters/blob/main/dbt-adapters/src/dbt/include/global_project/macros/adapters/columns.sql --#}\n {%- if dbt_version.startswith('2.') -%}\n {%- set select_sql = adapter.strip_trailing_statement_terminator(select_sql) -%}\n {%- endif -%}\n {#-- DIVERGENCE END --#}\n {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_empty_subquery_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_expected_sql": { + "name": "get_expected_sql", + "package_name": "dbt", + "path": "macros/unit_test_sql/get_fixture_sql.sql", + "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", + "unique_id": "macro.dbt.get_expected_sql", + "macro_sql": "{% macro get_expected_sql(rows, column_name_to_data_types, column_name_to_quoted) %}\n\n{%- if (rows | length) == 0 -%}\n select * from dbt_internal_unit_test_actual\n limit 0\n{%- else -%}\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\nselect\n{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n{%- endif -%}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.format_row" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_fixture_sql": { + "name": "get_fixture_sql", + "package_name": "dbt", + "path": "macros/unit_test_sql/get_fixture_sql.sql", + "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", + "unique_id": "macro.dbt.get_fixture_sql", + "macro_sql": "{% macro get_fixture_sql(rows, column_name_to_data_types) %}\n-- Fixture for {{ model.name }}\n{% set default_row = {} %}\n\n{%- if not column_name_to_data_types -%}\n{#-- Use defer_relation IFF it is available in the manifest and 'this' is missing from the database --#}\n{%- set this_or_defer_relation = defer_relation if (defer_relation and not load_relation(this)) else this -%}\n{%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%}\n\n{%- set column_name_to_data_types = {} -%}\n{%- set column_name_to_quoted = {} -%}\n{%- for column in columns_in_relation -%}\n\n{#-- This needs to be a case-insensitive comparison --#}\n{%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n{%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%}\n{%- endfor -%}\n{%- endif -%}\n\n{%- if not column_name_to_data_types -%}\n {{ exceptions.raise_compiler_error(\"Not able to get columns for unit test '\" ~ model.name ~ \"' from relation \" ~ this ~ \" because the relation doesn't exist\") }}\n{%- endif -%}\n\n{%- for column_name, column_type in column_name_to_data_types.items() -%}\n {%- do default_row.update({column_name: (safe_cast(\"null\", column_type) | trim )}) -%}\n{%- endfor -%}\n\n{{ validate_fixture_rows(rows, row_number) }}\n\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\n{%- set default_row_copy = default_row.copy() -%}\n{%- do default_row_copy.update(formatted_row) -%}\nselect\n{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n\n{%- if (rows | length) == 0 -%}\n select\n {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%},{%- endif %}\n {%- endfor %}\n limit 0\n{%- endif -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.format_row", + "macro.dbt.safe_cast", + "macro.dbt.validate_fixture_rows" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_formatted_aggregate_function_args": { + "name": "get_formatted_aggregate_function_args", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.get_formatted_aggregate_function_args", + "macro_sql": "{% macro get_formatted_aggregate_function_args() %}\n {{ return(adapter.dispatch('get_formatted_aggregate_function_args', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_formatted_aggregate_function_args" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_function_language_specifier": { + "name": "get_function_language_specifier", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.get_function_language_specifier", + "macro_sql": "{% macro get_function_language_specifier() %}\n {{ return(adapter.dispatch('get_function_language_specifier', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_function_language_specifier" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_function_macro": { + "name": "get_function_macro", + "package_name": "dbt", + "path": "macros/materializations/functions/helpers.sql", + "original_file_path": "macros/materializations/functions/helpers.sql", + "unique_id": "macro.dbt.get_function_macro", + "macro_sql": "{% macro get_function_macro(function_type, function_language) %}\n {{ return(adapter.dispatch('get_function_macro', 'dbt')(function_type, function_language)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_function_macro" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_function_python_options": { + "name": "get_function_python_options", + "package_name": "dbt", + "path": "macros/materializations/functions/aggregate.sql", + "original_file_path": "macros/materializations/functions/aggregate.sql", + "unique_id": "macro.dbt.get_function_python_options", + "macro_sql": "{% macro get_function_python_options() %}\n {{ return(adapter.dispatch('get_function_python_options', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_function_python_options" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_grant_sql": { + "name": "get_grant_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.get_grant_sql", + "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_grant_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_append_sql": { + "name": "get_incremental_append_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_append_sql", + "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_incremental_append_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_default_sql": { + "name": "get_incremental_default_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_default_sql", + "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_incremental_default_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_delete_insert_sql": { + "name": "get_incremental_delete_insert_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_delete_insert_sql", + "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_incremental_delete_insert_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_insert_overwrite_sql": { + "name": "get_incremental_insert_overwrite_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", + "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_incremental_insert_overwrite_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_merge_sql": { + "name": "get_incremental_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_merge_sql", + "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_incremental_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_incremental_microbatch_sql": { + "name": "get_incremental_microbatch_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_incremental_microbatch_sql", + "macro_sql": "{% macro get_incremental_microbatch_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_microbatch_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_incremental_microbatch_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_insert_into_sql": { + "name": "get_insert_into_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/strategies.sql", + "original_file_path": "macros/materializations/models/incremental/strategies.sql", + "unique_id": "macro.dbt.get_insert_into_sql", + "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ temp_relation }}\n )\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_insert_overwrite_merge_sql": { + "name": "get_insert_overwrite_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_insert_overwrite_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_intervals_between": { + "name": "get_intervals_between", + "package_name": "dbt", + "path": "macros/utils/date_spine.sql", + "original_file_path": "macros/utils/date_spine.sql", + "unique_id": "macro.dbt.get_intervals_between", + "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_intervals_between" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_limit_subquery_sql": { + "name": "get_limit_subquery_sql", + "package_name": "dbt", + "path": "macros/adapters/show.sql", + "original_file_path": "macros/adapters/show.sql", + "unique_id": "macro.dbt.get_limit_subquery_sql", + "macro_sql": "{%- macro get_limit_subquery_sql(sql, limit) -%}\n {{ adapter.dispatch('get_limit_sql', 'dbt')(sql, limit) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_limit_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_list_of_column_names": { + "name": "get_list_of_column_names", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.get_list_of_column_names", + "macro_sql": "{%- macro get_list_of_column_names(columns) -%}\n {% set col_names = [] %}\n {% for col in columns %}\n {% do col_names.append(col.name) %}\n {% endfor %}\n {{ return(col_names) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_materialized_view_configuration_changes": { + "name": "get_materialized_view_configuration_changes", + "package_name": "dbt", + "path": "macros/relations/materialized_view/alter.sql", + "original_file_path": "macros/relations/materialized_view/alter.sql", + "unique_id": "macro.dbt.get_materialized_view_configuration_changes", + "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n /* {#\n It's recommended that configuration changes be formatted as follows:\n {\"\": [{\"action\": \"\", \"context\": ...}]}\n\n For example:\n {\n \"indexes\": [\n {\"action\": \"drop\", \"context\": \"index_abc\"},\n {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n ],\n }\n\n Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n #} */\n {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_materialized_view_configuration_changes" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_merge_sql": { + "name": "get_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.get_merge_sql", + "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n -- back compat for old kwarg name\n {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_merge_unique_key_match": { + "name": "get_merge_unique_key_match", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/merge.sql", + "original_file_path": "macros/materializations/models/incremental/merge.sql", + "unique_id": "macro.dbt.get_merge_unique_key_match", + "macro_sql": "{% macro get_merge_unique_key_match(source_unique_key, target_unique_key) %}\n {{ return(adapter.dispatch('get_merge_unique_key_match', 'dbt')(source_unique_key, target_unique_key)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_merge_unique_key_match" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_merge_update_columns": { + "name": "get_merge_update_columns", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.get_merge_update_columns", + "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_merge_update_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_or_create_relation": { + "name": "get_or_create_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_or_create_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_powers_of_two": { + "name": "get_powers_of_two", + "package_name": "dbt", + "path": "macros/utils/generate_series.sql", + "original_file_path": "macros/utils/generate_series.sql", + "unique_id": "macro.dbt.get_powers_of_two", + "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_powers_of_two" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_quoted_csv": { + "name": "get_quoted_csv", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/column_helpers.sql", + "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_relation_last_modified": { + "name": "get_relation_last_modified", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.get_relation_last_modified", + "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_relation_last_modified" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_relations": { + "name": "get_relations", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.get_relations", + "macro_sql": "{% macro get_relations() %}\n {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_relations" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_relations_by_pattern_internal": { + "name": "get_relations_by_pattern_internal", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern.sql", + "original_file_path": "macros/relations/get_relations_by_pattern.sql", + "unique_id": "macro.dbt.get_relations_by_pattern_internal", + "macro_sql": "{% macro get_relations_by_pattern_internal(schema_pattern, table_pattern, exclude='', database=target.database, quote_table=False, excluded_schemas=[]) %}\n {{ return(adapter.dispatch('get_relations_by_pattern_internal')(schema_pattern, table_pattern, exclude, database, quote_table, excluded_schemas)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_relations_by_pattern_internal" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_rename_intermediate_sql": { + "name": "get_rename_intermediate_sql", + "package_name": "dbt", + "path": "macros/relations/rename_intermediate.sql", + "original_file_path": "macros/relations/rename_intermediate.sql", + "unique_id": "macro.dbt.get_rename_intermediate_sql", + "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_rename_intermediate_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_rename_materialized_view_sql": { + "name": "get_rename_materialized_view_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/rename.sql", + "original_file_path": "macros/relations/materialized_view/rename.sql", + "unique_id": "macro.dbt.get_rename_materialized_view_sql", + "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_rename_materialized_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_rename_sql": { + "name": "get_rename_sql", + "package_name": "dbt", + "path": "macros/relations/rename.sql", + "original_file_path": "macros/relations/rename.sql", + "unique_id": "macro.dbt.get_rename_sql", + "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n {{- log('Applying RENAME to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_rename_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_rename_table_sql": { + "name": "get_rename_table_sql", + "package_name": "dbt", + "path": "macros/relations/table/rename.sql", + "original_file_path": "macros/relations/table/rename.sql", + "unique_id": "macro.dbt.get_rename_table_sql", + "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_rename_table_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_rename_view_sql": { + "name": "get_rename_view_sql", + "package_name": "dbt", + "path": "macros/relations/view/rename.sql", + "original_file_path": "macros/relations/view/rename.sql", + "unique_id": "macro.dbt.get_rename_view_sql", + "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_rename_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_replace_materialized_view_sql": { + "name": "get_replace_materialized_view_sql", + "package_name": "dbt", + "path": "macros/relations/materialized_view/replace.sql", + "original_file_path": "macros/relations/materialized_view/replace.sql", + "unique_id": "macro.dbt.get_replace_materialized_view_sql", + "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_replace_materialized_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_replace_sql": { + "name": "get_replace_sql", + "package_name": "dbt", + "path": "macros/relations/replace.sql", + "original_file_path": "macros/relations/replace.sql", + "unique_id": "macro.dbt.get_replace_sql", + "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_replace_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_replace_table_sql": { + "name": "get_replace_table_sql", + "package_name": "dbt", + "path": "macros/relations/table/replace.sql", + "original_file_path": "macros/relations/table/replace.sql", + "unique_id": "macro.dbt.get_replace_table_sql", + "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_replace_table_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_replace_view_sql": { + "name": "get_replace_view_sql", + "package_name": "dbt", + "path": "macros/relations/view/replace.sql", + "original_file_path": "macros/relations/view/replace.sql", + "unique_id": "macro.dbt.get_replace_view_sql", + "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_replace_view_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_revoke_sql": { + "name": "get_revoke_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.get_revoke_sql", + "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_revoke_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_seed_column_quoted_csv": { + "name": "get_seed_column_quoted_csv", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_select_subquery": { + "name": "get_select_subquery", + "package_name": "dbt", + "path": "macros/relations/table/create.sql", + "original_file_path": "macros/relations/table/create.sql", + "unique_id": "macro.dbt.get_select_subquery", + "macro_sql": "{% macro get_select_subquery(sql) %}\n {#-- DIVERGENCE BEGIN: strip a terminal `;` so it does not land inside the\n wrapper built below; done at the dispatcher so the adapter overrides are\n covered too. See `StmtSplitter::strip_trailing_statement_terminator`.\n Upstream: https://github.com/dbt-labs/dbt-adapters/blob/main/dbt-adapters/src/dbt/include/global_project/macros/relations/table/create.sql --#}\n {%- if dbt_version.startswith('2.') -%}\n {%- set sql = adapter.strip_trailing_statement_terminator(sql) -%}\n {%- endif -%}\n {#-- DIVERGENCE END --#}\n {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_select_subquery" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_show_grant_sql": { + "name": "get_show_grant_sql", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.get_show_grant_sql", + "macro_sql": "{% macro get_show_grant_sql(relation) %}\n {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_show_grant_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_show_indexes_sql": { + "name": "get_show_indexes_sql", + "package_name": "dbt", + "path": "macros/adapters/indexes.sql", + "original_file_path": "macros/adapters/indexes.sql", + "unique_id": "macro.dbt.get_show_indexes_sql", + "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_show_indexes_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_show_sql": { + "name": "get_show_sql", + "package_name": "dbt", + "path": "macros/adapters/show.sql", + "original_file_path": "macros/adapters/show.sql", + "unique_id": "macro.dbt.get_show_sql", + "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n {%- if sql_header is not none -%}\n {{ sql_header }}\n {%- endif %}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_limit_subquery_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_snapshot_get_time_data_type": { + "name": "get_snapshot_get_time_data_type", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.get_snapshot_get_time_data_type", + "macro_sql": "{% macro get_snapshot_get_time_data_type() %}\n {% set snapshot_time = adapter.dispatch('snapshot_get_time', 'dbt')() %}\n {% set time_data_type_sql = 'select ' ~ snapshot_time ~ ' as dbt_snapshot_time' %}\n {% set snapshot_time_column_schema = get_column_schema_from_query(time_data_type_sql) %}\n {% set time_data_type = snapshot_time_column_schema[0].dtype %}\n {{ return(time_data_type or none) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_column_schema_from_query", + "macro.dbt_duckdb.duckdb__snapshot_get_time" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_snapshot_table_column_names": { + "name": "get_snapshot_table_column_names", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.get_snapshot_table_column_names", + "macro_sql": "{% macro get_snapshot_table_column_names() %}\n {{ return({'dbt_valid_to': 'dbt_valid_to', 'dbt_valid_from': 'dbt_valid_from', 'dbt_scd_id': 'dbt_scd_id', 'dbt_updated_at': 'dbt_updated_at', 'dbt_is_deleted': 'dbt_is_deleted'}) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_table_columns_and_constraints": { + "name": "get_table_columns_and_constraints", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.get_table_columns_and_constraints", + "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__get_table_columns_and_constraints" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_table_types_sql": { + "name": "get_table_types_sql", + "package_name": "dbt", + "path": "macros/relations/get_table_types_sql.sql", + "original_file_path": "macros/relations/get_table_types_sql.sql", + "unique_id": "macro.dbt.get_table_types_sql", + "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_tables_by_pattern_sql": { + "name": "get_tables_by_pattern_sql", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern_sql.sql", + "original_file_path": "macros/relations/get_relations_by_pattern_sql.sql", + "unique_id": "macro.dbt.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')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_tables_by_pattern_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_test_sql": { + "name": "get_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/helpers.sql", + "original_file_path": "macros/materializations/tests/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_test_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_true_sql": { + "name": "get_true_sql", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.get_true_sql", + "macro_sql": "{% macro get_true_sql() %}\n {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_true_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_unit_test_sql": { + "name": "get_unit_test_sql", + "package_name": "dbt", + "path": "macros/materializations/tests/helpers.sql", + "original_file_path": "macros/materializations/tests/helpers.sql", + "unique_id": "macro.dbt.get_unit_test_sql", + "macro_sql": "{% macro get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n {{ adapter.dispatch('get_unit_test_sql', 'dbt')(main_sql, expected_fixture_sql, expected_column_names) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_unit_test_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_updated_at_column_data_type": { + "name": "get_updated_at_column_data_type", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.get_updated_at_column_data_type", + "macro_sql": "{% macro get_updated_at_column_data_type(snapshot_sql) %}\n {% set snapshot_sql_column_schema = get_column_schema_from_query(snapshot_sql) %}\n {% set dbt_updated_at_data_type = null %}\n {% set ns = namespace() -%} {#-- handle for-loop scoping with a namespace --#}\n {% set ns.dbt_updated_at_data_type = null -%}\n {% for column in snapshot_sql_column_schema %}\n {% if ((column.column == 'dbt_updated_at') or (column.column == 'DBT_UPDATED_AT')) %}\n {% set ns.dbt_updated_at_data_type = column.dtype %}\n {% endif %}\n {% endfor %}\n {{ return(ns.dbt_updated_at_data_type or none) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_column_schema_from_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.get_where_subquery": { + "name": "get_where_subquery", + "package_name": "dbt", + "path": "macros/materializations/tests/where_subquery.sql", + "original_file_path": "macros/materializations/tests/where_subquery.sql", + "unique_id": "macro.dbt.get_where_subquery", + "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__get_where_subquery" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.handle_existing_table": { + "name": "handle_existing_table", + "package_name": "dbt", + "path": "macros/relations/view/replace.sql", + "original_file_path": "macros/relations/view/replace.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__handle_existing_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.hash": { + "name": "hash", + "package_name": "dbt", + "path": "macros/utils/hash.sql", + "original_file_path": "macros/utils/hash.sql", + "unique_id": "macro.dbt.hash", + "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__hash" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.in_transaction": { + "name": "in_transaction", + "package_name": "dbt", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt.in_transaction", + "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.incremental_validate_on_schema_change": { + "name": "incremental_validate_on_schema_change", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.information_schema_name": { + "name": "information_schema_name", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.information_schema_name", + "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__information_schema_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.intersect": { + "name": "intersect", + "package_name": "dbt", + "path": "macros/utils/intersect.sql", + "original_file_path": "macros/utils/intersect.sql", + "unique_id": "macro.dbt.intersect", + "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__intersect" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.is_incremental": { + "name": "is_incremental", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/is_incremental.sql", + "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.should_full_refresh" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.last_day": { + "name": "last_day", + "package_name": "dbt", + "path": "macros/utils/last_day.sql", + "original_file_path": "macros/utils/last_day.sql", + "unique_id": "macro.dbt.last_day", + "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__last_day" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.length": { + "name": "length", + "package_name": "dbt", + "path": "macros/utils/length.sql", + "original_file_path": "macros/utils/length.sql", + "unique_id": "macro.dbt.length", + "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__length" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.list_relations_without_caching": { + "name": "list_relations_without_caching", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__list_relations_without_caching" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.list_schemas": { + "name": "list_schemas", + "package_name": "dbt", + "path": "macros/adapters/metadata.sql", + "original_file_path": "macros/adapters/metadata.sql", + "unique_id": "macro.dbt.list_schemas", + "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__list_schemas" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.listagg": { + "name": "listagg", + "package_name": "dbt", + "path": "macros/utils/listagg.sql", + "original_file_path": "macros/utils/listagg.sql", + "unique_id": "macro.dbt.listagg", + "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__listagg" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.load_cached_relation": { + "name": "load_cached_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.load_cached_relation", + "macro_sql": "{% macro load_cached_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.load_csv_rows": { + "name": "load_csv_rows", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.load_csv_rows", + "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__load_csv_rows" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.load_relation": { + "name": "load_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.load_relation", + "macro_sql": "{% macro load_relation(relation) %}\n {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.load_cached_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.make_backup_relation": { + "name": "make_backup_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.make_backup_relation", + "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__make_backup_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.make_hook_config": { + "name": "make_hook_config", + "package_name": "dbt", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt.make_hook_config", + "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.make_intermediate_relation": { + "name": "make_intermediate_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.make_intermediate_relation", + "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__make_intermediate_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.make_temp_relation": { + "name": "make_temp_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.make_temp_relation", + "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {#-- This ensures microbatch batches get unique temp relations to avoid clobbering --#}\n {% if suffix == '__dbt_tmp' and model.batch %}\n {#-- TYPE CHECK: model.batch is optional --#}\n {% set suffix = suffix ~ '_' ~ model.batch.id %}\n {% endif %}\n\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__make_temp_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_aggregated_test_default": { + "name": "materialization_aggregated_test_default", + "package_name": "dbt", + "path": "macros/materializations/tests/aggregated_test.sql", + "original_file_path": "macros/materializations/tests/aggregated_test.sql", + "unique_id": "macro.dbt.materialization_aggregated_test_default", + "macro_sql": "{%- materialization aggregated_test, default -%}\n\n {% call statement('main', fetch_result=True) -%}\n {{ get_aggregated_test_sql(sql) }}\n {%- endcall %}\n\n {{ return({'relations': []}) }}\n\n{%- endmaterialization -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.get_aggregated_test_sql", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_clone_default": { + "name": "materialization_clone_default", + "package_name": "dbt", + "path": "macros/materializations/models/clone/clone.sql", + "original_file_path": "macros/materializations/models/clone/clone.sql", + "unique_id": "macro.dbt.materialization_clone_default", + "macro_sql": "{%- materialization clone, default -%}\n\n {%- set relations = {'relations': []} -%}\n\n {%- if not defer_relation -%}\n -- nothing to do\n {%- if model.config.materialized == 'ephemeral' -%}\n {{ log(\"Skipping clone for ephemeral model \" ~ model.unique_id, info=True) }}\n {%- else -%}\n {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n {%- endif -%}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n\n {%- if existing_relation and not flags.FULL_REFRESH -%}\n -- noop!\n {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n -- Otherwise, this will be a view\n\n {% set can_clone_table = can_clone_table() %}\n {%- set grant_config = config.get('grants') -%}\n\n {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {% if existing_relation is not none and not existing_relation.is_table %}\n {{ log(\"Dropping relation \" ~ existing_relation.render() ~ \" because it is of type \" ~ existing_relation.type) }}\n {{ drop_relation_if_exists(existing_relation) }}\n {% endif %}\n\n -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n {% if target_relation.database == defer_relation.database and\n target_relation.schema == defer_relation.schema and\n target_relation.identifier == defer_relation.identifier %}\n {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation.render()) }}\n {% else %}\n {% call statement('main') %}\n {{ create_or_replace_clone(target_relation, defer_relation) }}\n {% endcall %}\n {% endif %}\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n {%- else -%}\n\n {%- set target_relation = this.incorporate(type='view') -%}\n\n -- reuse the view materialization\n -- TODO: support actual dispatch for materialization macros\n -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n {% if not search_name in context %}\n {% set search_name = \"materialization_view_default\" %}\n {% endif %}\n {% set materialization_macro = context[search_name] %}\n {% set relations = materialization_macro() %}\n {{ return(relations) }}\n\n {%- endif -%}\n\n{%- endmaterialization -%}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.can_clone_table", + "macro.dbt.create_or_replace_clone", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.load_cached_relation", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_function_default": { + "name": "materialization_function_default", + "package_name": "dbt", + "path": "macros/materializations/functions/function.sql", + "original_file_path": "macros/materializations/functions/function.sql", + "unique_id": "macro.dbt.materialization_function_default", + "macro_sql": "{% materialization function, default, supported_languages=['sql', 'python', 'javascript'] %}\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.Function) %}\n\n {% if execute %}\n {{ run_hooks(pre_hooks) }}\n\n {% set function_type_macro = get_function_macro(model.config.type, model.language) %}\n {% set build_sql = function_type_macro(target_relation) %}\n\n {{ function_execute_build_sql(build_sql, existing_relation, target_relation) }}\n\n {{ run_hooks(post_hooks) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.function_execute_build_sql", + "macro.dbt.get_function_macro", + "macro.dbt.load_cached_relation", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "supported_languages": [ + "sql", + "python", + "javascript" + ], + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_incremental_default": { + "name": "materialization_incremental_default", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/incremental.sql", + "original_file_path": "macros/materializations/models/incremental/incremental.sql", + "unique_id": "macro.dbt.materialization_incremental_default", + "macro_sql": "{% materialization incremental, default -%}\n\n -- relations\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n -- configs\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%} -- noqa: existing_relation could be None\n {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%} -- noqa: incremental_validate_on_schema_change 1st parameter is not nullable\n\n -- the temp_ 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 = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\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 {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n\n {% if existing_relation is none %}\n {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n {% set relation_for_indexes = target_relation %}\n {% elif full_refresh_mode %}\n {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n {% set relation_for_indexes = intermediate_relation %}\n {% set need_swap = true %}\n {% else %}\n {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n {% set relation_for_indexes = temp_relation %}\n {% set contract_config = config.get('contract') %}\n {% if not contract_config or not contract_config.enforced %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {% endif %}\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, temp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(relation_for_indexes) %}\n {% endif %}\n\n {% if need_swap %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% do to_drop.append(backup_relation) %}\n {% endif %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_indexes", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.get_create_table_as_sql", + "macro.dbt.incremental_validate_on_schema_change", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.make_temp_relation", + "macro.dbt.persist_docs", + "macro.dbt.process_schema_changes", + "macro.dbt.run_query", + "macro.dbt.should_full_refresh", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_materialized_view_default": { + "name": "materialization_materialized_view_default", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialization_materialized_view_default", + "macro_sql": "{% materialization materialized_view, default %}\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% if build_sql == '' %}\n {{ materialized_view_execute_no_op(target_relation) }}\n {% else %}\n {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n {% endif %}\n\n {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.materialized_view_execute_build_sql", + "macro.dbt.materialized_view_execute_no_op", + "macro.dbt.materialized_view_get_build_sql", + "macro.dbt.materialized_view_setup", + "macro.dbt.materialized_view_teardown" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_seed_default": { + "name": "materialization_seed_default", + "package_name": "dbt", + "path": "macros/materializations/seeds/seed.sql", + "original_file_path": "macros/materializations/seeds/seed.sql", + "unique_id": "macro.dbt.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 grant_config = config.get('grants') -%}\n {%- set agate_table = load_agate_table() -%}\n -- grab current tables grants config for comparison later on\n\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.render())) }} -- noqa: optional[relation] does not support render()\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %} -- noqa: optional[relation] as arguments\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 = \"\" %}\n {% if rows_affected > 0 %}\n {% set sql = load_csv_rows(model, agate_table) %}\n {% endif %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %} -- noqa: Should accept a string instead of a integer\n {{ get_csv_sql(create_table_sql, sql) }};\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_csv_table", + "macro.dbt.create_indexes", + "macro.dbt.get_csv_sql", + "macro.dbt.load_csv_rows", + "macro.dbt.noop_statement", + "macro.dbt.persist_docs", + "macro.dbt.reset_csv_table", + "macro.dbt.should_full_refresh", + "macro.dbt.should_revoke", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_snapshot_default": { + "name": "materialization_snapshot_default", + "package_name": "dbt", + "path": "macros/materializations/snapshots/snapshot.sql", + "original_file_path": "macros/materializations/snapshots/snapshot.sql", + "unique_id": "macro.dbt.materialization_snapshot_default", + "macro_sql": "{% materialization snapshot, default %}\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 -- grab current tables grants config for comparision later on\n {%- set grant_config = config.get('grants') -%}\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 {# The model['config'] parameter below is no longer used, but passing anyway for compatibility #}\n {# It was a dictionary of config, instead of the config object from the context #}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", model['config'], target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_code']) %}\n {% set build_or_select_sql = build_sql %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {% set columns = config.get(\"snapshot_table_column_names\") or get_snapshot_table_column_names() %}\n\n {{ adapter.assert_valid_snapshot_target_given_strategy(target_relation, columns, strategy) }}\n\n {% set build_or_select_sql = snapshot_staging_table(strategy, sql, target_relation) %}\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 remove_columns = ['dbt_change_type', 'DBT_CHANGE_TYPE', 'dbt_unique_key', 'DBT_UNIQUE_KEY'] %}\n {% if unique_key | is_list %}\n {% for key in strategy.unique_key %}\n {{ remove_columns.append('dbt_unique_key_' + loop.index|string) }}\n {{ remove_columns.append('DBT_UNIQUE_KEY_' + loop.index|string) }}\n {% endfor %}\n {% endif %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'in', remove_columns)\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', 'in', remove_columns)\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\n {{ check_time_data_types(build_or_select_sql) }}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.build_snapshot_table", + "macro.dbt.check_time_data_types", + "macro.dbt.create_columns", + "macro.dbt.create_indexes", + "macro.dbt.create_table_as", + "macro.dbt.get_or_create_relation", + "macro.dbt.get_snapshot_table_column_names", + "macro.dbt.persist_docs", + "macro.dbt.post_snapshot", + "macro.dbt.should_revoke", + "macro.dbt.snapshot_merge_sql", + "macro.dbt.snapshot_staging_table", + "macro.dbt.statement", + "macro.dbt.strategy_dispatch", + "macro.dbt_duckdb.build_snapshot_staging_table", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_table_default": { + "name": "materialization_table_default", + "package_name": "dbt", + "path": "macros/materializations/models/table.sql", + "original_file_path": "macros/materializations/models/table.sql", + "unique_id": "macro.dbt.materialization_table_default", + "macro_sql": "{% materialization table, default %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\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 = load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\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 {% do create_indexes(intermediate_relation) %}\n\n -- cleanup\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_indexes", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.get_create_table_as_sql", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_test_default": { + "name": "materialization_test_default", + "package_name": "dbt", + "path": "macros/materializations/tests/test.sql", + "original_file_path": "macros/materializations/tests/test.sql", + "unique_id": "macro.dbt.materialization_test_default", + "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n {% set limit = config.get('limit') %}\n {# DIVERGENCE: FIXME: support REQUIRE_SQL_HEADER_IN_TEST_CONFIGS flag #}\n {% set sql_header = config.get('sql_header') if flags.REQUIRE_SQL_HEADER_IN_TEST_CONFIGS else none %}\n\n {% set sql_with_limit %}\n {{ get_limit_subquery_sql(sql, limit) }}\n {% endset %}\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\n {% set store_failures_as = config.get('store_failures_as') %}\n -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n -- config.get('store_failures_as', 'table') returns None, not 'table'\n {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n {% if store_failures_as not in ['table', 'view'] %}\n {{ exceptions.raise_compiler_error(\n \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n \"Accepted values are: ['ephemeral', 'table', 'view']\"\n ) }}\n {% endif %}\n\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n\n {% call statement(auto_begin=True) %}\n {% if sql_header %}{{ sql_header }}{% endif %}\n {{ get_create_sql(target_relation, sql_with_limit) }}\n {% endcall %}\n\n {% do relations.append(target_relation) %}\n\n {# Since the test failures have already been saved to the database, reuse that result rather than querying again #}\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_with_limit %}\n\n {% endif %}\n\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 {% if sql_header %}{{ sql_header }}{% endif %}\n {# The limit has already been included above, and we do not want to duplicate it again. We also want to be safe for macro overrides treating `limit` as a required parameter. #}\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit=none)}}\n\n {%- endcall %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_sql", + "macro.dbt.get_limit_subquery_sql", + "macro.dbt.get_test_sql", + "macro.dbt.should_store_failures", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_unit_default": { + "name": "materialization_unit_default", + "package_name": "dbt", + "path": "macros/materializations/tests/unit.sql", + "original_file_path": "macros/materializations/tests/unit.sql", + "unique_id": "macro.dbt.materialization_unit_default", + "macro_sql": "{%- materialization unit, default -%}\n\n {% set relations = [] %}\n {# DIVERGENCE: FIXME: support REQUIRE_SQL_HEADER_IN_TEST_CONFIGS flag #}\n {% set sql_header = config.get('sql_header') if flags.REQUIRE_SQL_HEADER_IN_TEST_CONFIGS else none %}\n\n {% set expected_rows = config.get('expected_rows') %}\n {% set expected_sql = config.get('expected_sql') %}\n {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} -- noqa: operations may fail as expected_rows may be none\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}\n {%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}\n {%- set column_name_to_data_types = {} -%}\n {%- set column_name_to_quoted = {} -%}\n {%- for column in columns_in_relation -%}\n {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n {%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%}\n {%- endfor -%}\n\n {%- set expected_column_names_quoted = [] -%}\n {%- for column_name in tested_expected_column_names -%}\n {%- do expected_column_names_quoted.append(column_name_to_quoted[column_name|lower]) -%}\n {%- endfor -%}\n\n {% if not expected_sql %}\n {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types, column_name_to_quoted) %}\n {% endif %}\n {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, expected_column_names_quoted) %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {% if sql_header %}{{ sql_header }}{% endif %}\n {{ unit_test_sql }}\n\n {%- endcall %}\n\n {% do adapter.drop_relation(temp_relation) %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", + "depends_on": { + "macros": [ + "macro.dbt.get_create_table_as_sql", + "macro.dbt.get_empty_subquery_sql", + "macro.dbt.get_expected_sql", + "macro.dbt.get_unit_test_sql", + "macro.dbt.make_temp_relation", + "macro.dbt.run_query", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialization_view_default": { + "name": "materialization_view_default", + "package_name": "dbt", + "path": "macros/materializations/models/view.sql", + "original_file_path": "macros/materializations/models/view.sql", + "unique_id": "macro.dbt.materialization_view_default", + "macro_sql": "{%- materialization view, default -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n\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 = load_cached_relation(intermediate_relation) -%}\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 \"existing_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 existing_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the existing_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 existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\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 {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 -%}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.get_create_view_as_sql", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialized_view_execute_build_sql": { + "name": "materialized_view_execute_build_sql", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialized_view_execute_build_sql", + "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialized_view_execute_no_op": { + "name": "materialized_view_execute_no_op", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialized_view_execute_no_op", + "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ target_relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialized_view_get_build_sql": { + "name": "materialized_view_get_build_sql", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialized_view_get_build_sql", + "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = refresh_materialized_view(target_relation) %}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation.render() ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation.render() ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_alter_materialized_view_as_sql", + "macro.dbt.get_create_materialized_view_as_sql", + "macro.dbt.get_materialized_view_configuration_changes", + "macro.dbt.get_replace_sql", + "macro.dbt.refresh_materialized_view", + "macro.dbt.should_full_refresh" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialized_view_setup": { + "name": "materialized_view_setup", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialized_view_setup", + "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n -- backup_relation and intermediate_relation should not already exist in the database\n -- it's possible these exist because of a previous run that exited unexpectedly\n {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.drop_relation_if_exists", + "macro.dbt.load_cached_relation", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.materialized_view_teardown": { + "name": "materialized_view_teardown", + "package_name": "dbt", + "path": "macros/materializations/models/materialized_view.sql", + "original_file_path": "macros/materializations/models/materialized_view.sql", + "unique_id": "macro.dbt.materialized_view_teardown", + "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n -- drop the temp relations if they exist to leave the database clean for the next run\n {{ drop_relation_if_exists(backup_relation) }}\n {{ drop_relation_if_exists(intermediate_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.drop_relation_if_exists", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.noop_statement": { + "name": "noop_statement", + "package_name": "dbt", + "path": "macros/etc/statement.sql", + "original_file_path": "macros/etc/statement.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.partition_range": { + "name": "partition_range", + "package_name": "dbt", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.dates_in_range" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.persist_docs": { + "name": "persist_docs", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__persist_docs" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.position": { + "name": "position", + "package_name": "dbt", + "path": "macros/utils/position.sql", + "original_file_path": "macros/utils/position.sql", + "unique_id": "macro.dbt.position", + "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__position" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.post_snapshot": { + "name": "post_snapshot", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.post_snapshot", + "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__post_snapshot" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.postgres__get_table_types_sql": { + "name": "postgres__get_table_types_sql", + "package_name": "dbt", + "path": "macros/relations/get_table_types_sql.sql", + "original_file_path": "macros/relations/get_table_types_sql.sql", + "unique_id": "macro.dbt.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 {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.process_schema_changes": { + "name": "process_schema_changes", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.process_schema_changes", + "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n {{ return(adapter.dispatch('process_schema_changes', 'dbt')(on_schema_change, source_relation, target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__process_schema_changes" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.py_current_timestring": { + "name": "py_current_timestring", + "package_name": "dbt", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.py_script_comment": { + "name": "py_script_comment", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.py_script_comment", + "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.py_script_postfix": { + "name": "py_script_postfix", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.py_script_postfix", + "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n def __init__(self, *args, **kwargs):\n pass\n\n @staticmethod\n def get(key, default=None):\n return config_dict.get(key, default)\n\n @staticmethod\n def meta_get(key, default=None):\n return meta_dict.get(key, default)\n\nclass this:\n \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n database = \"{{ this.database }}\"\n schema = \"{{ this.schema }}\"\n identifier = \"{{ this.identifier }}\"\n {% set this_relation_name = resolve_model_name(this) %}\n def __repr__(self):\n return '{{ this_relation_name }}'\n\n\nclass dbtObj:\n def __init__(self, load_df_function) -> None:\n self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n self.config = config\n self.this = this()\n self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.build_config_dict", + "macro.dbt.build_ref_function", + "macro.dbt.build_source_function", + "macro.dbt.is_incremental", + "macro.dbt.py_script_comment", + "macro.dbt.resolve_model_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.redshift__get_tables_by_pattern_sql": { + "name": "redshift__get_tables_by_pattern_sql", + "package_name": "dbt", + "path": "macros/relations/get_relations_by_pattern_sql.sql", + "original_file_path": "macros/relations/get_relations_by_pattern_sql.sql", + "unique_id": "macro.dbt.redshift__get_tables_by_pattern_sql", + "macro_sql": "{% macro redshift__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% set sql %}\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ adapter.dispatch('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 union all\n select distinct\n schemaname as {{ adapter.quote('table_schema') }},\n tablename as {{ adapter.quote('table_name') }},\n 'external' as {{ adapter.quote('table_type') }}\n from svv_external_tables\n where redshift_database_name = '{{ database }}'\n and schemaname ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n {% endset %}\n\n {{ return(sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.redshift__t_database_name": { + "name": "redshift__t_database_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.redshift__t_database_name", + "macro_sql": "{% macro redshift__t_database_name() %}\n {{ return(env_var('REDSHIFT_DATABASE')) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.refresh_materialized_view": { + "name": "refresh_materialized_view", + "package_name": "dbt", + "path": "macros/relations/materialized_view/refresh.sql", + "original_file_path": "macros/relations/materialized_view/refresh.sql", + "unique_id": "macro.dbt.refresh_materialized_view", + "macro_sql": "{% macro refresh_materialized_view(relation) %}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__refresh_materialized_view" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.rename_relation": { + "name": "rename_relation", + "package_name": "dbt", + "path": "macros/relations/rename.sql", + "original_file_path": "macros/relations/rename.sql", + "unique_id": "macro.dbt.rename_relation", + "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__rename_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.replace": { + "name": "replace", + "package_name": "dbt", + "path": "macros/utils/replace.sql", + "original_file_path": "macros/utils/replace.sql", + "unique_id": "macro.dbt.replace", + "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__replace" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.reset_csv_table": { + "name": "reset_csv_table", + "package_name": "dbt", + "path": "macros/materializations/seeds/helpers.sql", + "original_file_path": "macros/materializations/seeds/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__reset_csv_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.resolve_model_name": { + "name": "resolve_model_name", + "package_name": "dbt", + "path": "macros/python_model/python.sql", + "original_file_path": "macros/python_model/python.sql", + "unique_id": "macro.dbt.resolve_model_name", + "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__resolve_model_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.right": { + "name": "right", + "package_name": "dbt", + "path": "macros/utils/right.sql", + "original_file_path": "macros/utils/right.sql", + "unique_id": "macro.dbt.right", + "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__right" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.run_hooks": { + "name": "run_hooks", + "package_name": "dbt", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.run_query": { + "name": "run_query", + "package_name": "dbt", + "path": "macros/etc/statement.sql", + "original_file_path": "macros/etc/statement.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.safe_cast": { + "name": "safe_cast", + "package_name": "dbt", + "path": "macros/utils/safe_cast.sql", + "original_file_path": "macros/utils/safe_cast.sql", + "unique_id": "macro.dbt.safe_cast", + "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__safe_cast" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.scalar_function_body_sql": { + "name": "scalar_function_body_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.scalar_function_body_sql", + "macro_sql": "{% macro scalar_function_body_sql() %}\n {{ return(adapter.dispatch('scalar_function_body_sql', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__scalar_function_body_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.scalar_function_create_replace_signature_sql": { + "name": "scalar_function_create_replace_signature_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.scalar_function_create_replace_signature_sql", + "macro_sql": "{% macro scalar_function_create_replace_signature_sql(target_relation) %}\n {{ return(adapter.dispatch('scalar_function_create_replace_signature_sql', 'dbt')(target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__scalar_function_create_replace_signature_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.scalar_function_sql": { + "name": "scalar_function_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.scalar_function_sql", + "macro_sql": "{% macro scalar_function_sql(target_relation) %}\n {{ return(adapter.dispatch('scalar_function_sql', 'dbt')(target_relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__scalar_function_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.scalar_function_volatility_javascript": { + "name": "scalar_function_volatility_javascript", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.scalar_function_volatility_javascript", + "macro_sql": "{% macro scalar_function_volatility_javascript() %}\n {{ return(adapter.dispatch('scalar_function_volatility_javascript', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__scalar_function_volatility_javascript" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.scalar_function_volatility_sql": { + "name": "scalar_function_volatility_sql", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.scalar_function_volatility_sql", + "macro_sql": "{% macro scalar_function_volatility_sql() %}\n {{ return(adapter.dispatch('scalar_function_volatility_sql', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__scalar_function_volatility_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.set_sql_header": { + "name": "set_sql_header", + "package_name": "dbt", + "path": "macros/materializations/configs.sql", + "original_file_path": "macros/materializations/configs.sql", + "unique_id": "macro.dbt.set_sql_header", + "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.should_full_refresh": { + "name": "should_full_refresh", + "package_name": "dbt", + "path": "macros/materializations/configs.sql", + "original_file_path": "macros/materializations/configs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.should_revoke": { + "name": "should_revoke", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.should_revoke", + "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n {% if not existing_relation %}\n {#-- The table doesn't already exist, so no grants to copy over --#}\n {{ return(False) }}\n {% elif full_refresh_mode %}\n {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n {{ return(copy_grants()) }}\n {% else %}\n {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n {{ return(True) }}\n {% endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.copy_grants" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.should_store_failures": { + "name": "should_store_failures", + "package_name": "dbt", + "path": "macros/materializations/configs.sql", + "original_file_path": "macros/materializations/configs.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_check_all_get_existing_columns": { + "name": "snapshot_check_all_get_existing_columns", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", + "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n {%- if not target_exists -%}\n {#-- no table yet -> return whatever the query does --#}\n {{ return((false, query_columns)) }}\n {%- endif -%}\n\n {#-- handle any schema changes --#}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n {% if check_cols_config == 'all' %}\n {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {#-- query for proper casing/quoting, to support comparison below --#}\n {%- set select_check_cols_from_target -%}\n {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n select {{ check_cols_config | join(', ') }} from (\n {{ node['compiled_code'] }}\n ) subq\n {%- endset -%}\n {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\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 adapter.dispatch('snapshot_check_column_exists', 'dbt')(col, existing_cols) -%}\n {%- do intersection.append(adapter.quote(col)) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__snapshot_check_column_exists" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_check_strategy": { + "name": "snapshot_check_strategy", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.snapshot_check_strategy", + "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, model_config, target_exists) %}\n {# The model_config parameter is no longer used, but is passed in anyway for compatibility. #}\n {% set check_cols_config = config.get('check_cols') %}\n {% set primary_key = config.get('unique_key') %}\n {% set hard_deletes = adapter.get_hard_deletes_behavior(config) %}\n {% set invalidate_hard_deletes = hard_deletes == 'invalidate' %}\n {% set updated_at = config.get('updated_at') or snapshot_get_time() %}\n\n {% set column_added = false %}\n\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %} -- noqa: check_cols_config is a string|list[string]|none\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n {{ get_true_sql() }}\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_args = api.Relation.scd_args(primary_key, updated_at) %} -- noqa: primary_key is a string|list[string]|none\n {% set scd_id_expr = snapshot_hash_arguments(scd_args) %}\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 \"hard_deletes\": hard_deletes\n }) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_true_sql", + "macro.dbt.snapshot_check_all_get_existing_columns", + "macro.dbt.snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_get_time": { + "name": "snapshot_get_time", + "package_name": "dbt", + "path": "macros/adapters/timestamps.sql", + "original_file_path": "macros/adapters/timestamps.sql", + "unique_id": "macro.dbt.snapshot_get_time", + "macro_sql": "{%- macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__snapshot_get_time" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_hash_arguments": { + "name": "snapshot_hash_arguments", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.snapshot_hash_arguments", + "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_merge_sql": { + "name": "snapshot_merge_sql", + "package_name": "dbt", + "path": "macros/materializations/snapshots/snapshot_merge.sql", + "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__snapshot_merge_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_staging_table": { + "name": "snapshot_staging_table", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__snapshot_staging_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_string_as_time": { + "name": "snapshot_string_as_time", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.snapshot_string_as_time", + "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__snapshot_string_as_time" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.snapshot_timestamp_strategy": { + "name": "snapshot_timestamp_strategy", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.snapshot_timestamp_strategy", + "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, model_config, target_exists) %}\n {# The model_config parameter is no longer used, but is passed in anyway for compatibility. #}\n {% set primary_key = config.get('unique_key') %}\n {% set updated_at = config.get('updated_at') %}\n {% set hard_deletes = adapter.get_hard_deletes_behavior(config) %}\n {% set invalidate_hard_deletes = hard_deletes == 'invalidate' %}\n {% set columns = config.get(\"snapshot_table_column_names\") or get_snapshot_table_column_names() %}\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 }}.{{ columns.dbt_valid_from }} < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_args = api.Relation.scd_args(primary_key, updated_at) %} -- noqa: updated_at should be a string\n {% set scd_id_expr = snapshot_hash_arguments(scd_args) %}\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 \"hard_deletes\": hard_deletes\n }) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_snapshot_table_column_names", + "macro.dbt.snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.split_part": { + "name": "split_part", + "package_name": "dbt", + "path": "macros/utils/split_part.sql", + "original_file_path": "macros/utils/split_part.sql", + "unique_id": "macro.dbt.split_part", + "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__split_part" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.sql_convert_columns_in_relation": { + "name": "sql_convert_columns_in_relation", + "package_name": "dbt", + "path": "macros/adapters/columns.sql", + "original_file_path": "macros/adapters/columns.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.statement": { + "name": "statement", + "package_name": "dbt", + "path": "macros/etc/statement.sql", + "original_file_path": "macros/etc/statement.sql", + "unique_id": "macro.dbt.statement", + "macro_sql": "{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n {%- if execute: -%}\n {%- set compiled_code = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n {{ write(compiled_code) }}\n {%- endif -%}\n {%- if language == 'sql'-%}\n {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- elif language == 'python' -%}\n {%- set res = submit_python_job(model, compiled_code) -%}\n {#-- TODO: What should table be for python models? --#}\n {%- set table = None -%}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.strategy_dispatch": { + "name": "strategy_dispatch", + "package_name": "dbt", + "path": "macros/materializations/snapshots/strategies.sql", + "original_file_path": "macros/materializations/snapshots/strategies.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.string_literal": { + "name": "string_literal", + "package_name": "dbt", + "path": "macros/utils/literal.sql", + "original_file_path": "macros/utils/literal.sql", + "unique_id": "macro.dbt.string_literal", + "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__string_literal" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.support_multiple_grantees_per_dcl_statement": { + "name": "support_multiple_grantees_per_dcl_statement", + "package_name": "dbt", + "path": "macros/adapters/apply_grants.sql", + "original_file_path": "macros/adapters/apply_grants.sql", + "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", + "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__support_multiple_grantees_per_dcl_statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.sync_column_schemas": { + "name": "sync_column_schemas", + "package_name": "dbt", + "path": "macros/materializations/models/incremental/on_schema_change.sql", + "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", + "unique_id": "macro.dbt.sync_column_schemas", + "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n {{ return(adapter.dispatch('sync_column_schemas', 'dbt')(on_schema_change, target_relation, schema_changes_dict)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__sync_column_schemas" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.t_database_name": { + "name": "t_database_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.t_database_name", + "macro_sql": "{% macro t_database_name() %}\n {{ return (adapter.dispatch(\"t_database_name\")()) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__t_database_name" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.t_schema_name": { + "name": "t_schema_name", + "package_name": "dbt", + "path": "macros/internal/test/names.sql", + "original_file_path": "macros/internal/test/names.sql", + "unique_id": "macro.dbt.t_schema_name", + "macro_sql": "{% macro t_schema_name() %}\n {{ return(target.schema) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.table_columns_and_constraints": { + "name": "table_columns_and_constraints", + "package_name": "dbt", + "path": "macros/relations/column/columns_spec_ddl.sql", + "original_file_path": "macros/relations/column/columns_spec_ddl.sql", + "unique_id": "macro.dbt.table_columns_and_constraints", + "macro_sql": "{% macro table_columns_and_constraints() %}\n {# loop through user_provided_columns to create DDL with data types and constraints #}\n {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n (\n {% for c in raw_column_constraints -%}\n {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n {% endfor %}\n {% for c in raw_model_constraints -%}\n {{ c }}{{ \",\" if not loop.last }}\n {% endfor -%}\n )\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_accepted_values": { + "name": "test_accepted_values", + "package_name": "dbt", + "path": "tests/generic/builtin.sql", + "original_file_path": "tests/generic/builtin.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_accepted_values" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_aggregated_not_null": { + "name": "test_aggregated_not_null", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_not_null.sql", + "original_file_path": "macros/generic_test_sql/aggregated_not_null.sql", + "unique_id": "macro.dbt.test_aggregated_not_null", + "macro_sql": "{% test aggregated_not_null(model, column_names) %}\n {% set macro = adapter.dispatch('test_aggregated_not_null', 'dbt') %}\n {{ macro(model, column_names) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_aggregated_not_null" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_aggregated_unique": { + "name": "test_aggregated_unique", + "package_name": "dbt", + "path": "macros/generic_test_sql/aggregated_unique.sql", + "original_file_path": "macros/generic_test_sql/aggregated_unique.sql", + "unique_id": "macro.dbt.test_aggregated_unique", + "macro_sql": "{% test aggregated_unique(model, column_names) %}\n {% set macro = adapter.dispatch('test_aggregated_unique', 'dbt') %}\n {{ macro(model, column_names) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_aggregated_unique" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_not_null": { + "name": "test_not_null", + "package_name": "dbt", + "path": "tests/generic/builtin.sql", + "original_file_path": "tests/generic/builtin.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_not_null" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_relationships": { + "name": "test_relationships", + "package_name": "dbt", + "path": "tests/generic/builtin.sql", + "original_file_path": "tests/generic/builtin.sql", + "unique_id": "macro.dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_relationships" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.test_unique": { + "name": "test_unique", + "package_name": "dbt", + "path": "tests/generic/builtin.sql", + "original_file_path": "tests/generic/builtin.sql", + "unique_id": "macro.dbt.test_unique", + "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt.default__test_unique" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.truncate_relation": { + "name": "truncate_relation", + "package_name": "dbt", + "path": "macros/adapters/relation.sql", + "original_file_path": "macros/adapters/relation.sql", + "unique_id": "macro.dbt.truncate_relation", + "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__truncate_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_bigint": { + "name": "type_bigint", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_bigint", + "macro_sql": "{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_bigint" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_boolean": { + "name": "type_boolean", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_boolean", + "macro_sql": "{%- macro type_boolean() -%}\n {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_boolean" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_float": { + "name": "type_float", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_float", + "macro_sql": "{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_float" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_int": { + "name": "type_int", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_int", + "macro_sql": "{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_int" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_numeric": { + "name": "type_numeric", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_numeric", + "macro_sql": "{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_numeric" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_string": { + "name": "type_string", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_string", + "macro_sql": "{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.type_timestamp": { + "name": "type_timestamp", + "package_name": "dbt", + "path": "macros/utils/data_types.sql", + "original_file_path": "macros/utils/data_types.sql", + "unique_id": "macro.dbt.type_timestamp", + "macro_sql": "{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__type_timestamp" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.unique_key_fields": { + "name": "unique_key_fields", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.unique_key_fields", + "macro_sql": "{% macro unique_key_fields(unique_key) %}\n {% if unique_key | is_list %}\n {% for key in unique_key %}\n {{ key }} as dbt_unique_key_{{ loop.index }}\n {%- if not loop.last %} , {%- endif %}\n {% endfor %}\n {% else %}\n {{ unique_key }} as dbt_unique_key\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.unique_key_is_not_null": { + "name": "unique_key_is_not_null", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.unique_key_is_not_null", + "macro_sql": "{% macro unique_key_is_not_null(unique_key, identifier) %}\n {% if unique_key | is_list %}\n {{ identifier }}.dbt_unique_key_1 is not null\n {% else %}\n {{ identifier }}.dbt_unique_key is not null\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.unique_key_is_null": { + "name": "unique_key_is_null", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.unique_key_is_null", + "macro_sql": "{% macro unique_key_is_null(unique_key, identifier) %}\n {% if unique_key | is_list %}\n {{ identifier }}.dbt_unique_key_1 is null\n {% else %}\n {{ identifier }}.dbt_unique_key is null\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.unique_key_join_on": { + "name": "unique_key_join_on", + "package_name": "dbt", + "path": "macros/materializations/snapshots/helpers.sql", + "original_file_path": "macros/materializations/snapshots/helpers.sql", + "unique_id": "macro.dbt.unique_key_join_on", + "macro_sql": "{% macro unique_key_join_on(unique_key, identifier, from_identifier) %}\n {% if unique_key | is_list %}\n {% for key in unique_key %}\n\t {% set source_unique_key = (identifier ~ \".dbt_unique_key_\" ~ loop.index) | trim %}\n\t {% set target_unique_key = (from_identifier ~ \".dbt_unique_key_\" ~ loop.index) | trim %}\n\t {{ equals(source_unique_key, target_unique_key) }}\n {%- if not loop.last %} and {%- endif %}\n {% endfor %}\n {% else %}\n {{ identifier }}.dbt_unique_key = {{ from_identifier }}.dbt_unique_key\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.equals" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.unsupported_volatility_warning": { + "name": "unsupported_volatility_warning", + "package_name": "dbt", + "path": "macros/materializations/functions/scalar.sql", + "original_file_path": "macros/materializations/functions/scalar.sql", + "unique_id": "macro.dbt.unsupported_volatility_warning", + "macro_sql": "{% macro unsupported_volatility_warning(volatility) %}\n {{ return(adapter.dispatch('unsupported_volatility_warning', 'dbt')(volatility)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__unsupported_volatility_warning" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.validate_doc_columns": { + "name": "validate_doc_columns", + "package_name": "dbt", + "path": "macros/adapters/persist_docs.sql", + "original_file_path": "macros/adapters/persist_docs.sql", + "unique_id": "macro.dbt.validate_doc_columns", + "macro_sql": "{% macro validate_doc_columns(relation, column_dict, existing_column_names, case_insensitive=false) %}\n {% set existing_lower = existing_column_names | map(\"lower\") | list %}\n {% set missing = [] %}\n {% set filtered = {} %}\n {% for col_name in column_dict %}\n {% set is_quoted = column_dict[col_name]['quote'] %}\n {% if case_insensitive or not is_quoted %}\n {% set present = col_name | lower in existing_lower %}\n {% else %}\n {% set present = col_name in existing_column_names %}\n {% endif %}\n {% if present %}\n {% do filtered.update({col_name: column_dict[col_name]}) %}\n {% else %}\n {% do missing.append(col_name) %}\n {% endif %}\n {% endfor %}\n {% if missing | length > 0 %}\n {{ exceptions.warn(\"In relation \" ~ relation.render() ~ \": The following columns are specified in the schema but are not present in the database: \" ~ missing | join(\", \")) }}\n {% endif %}\n {{ return(filtered) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.validate_fixture_rows": { + "name": "validate_fixture_rows", + "package_name": "dbt", + "path": "macros/unit_test_sql/get_fixture_sql.sql", + "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", + "unique_id": "macro.dbt.validate_fixture_rows", + "macro_sql": "{%- macro validate_fixture_rows(rows, row_number) -%}\n {{ return(adapter.dispatch('validate_fixture_rows', 'dbt')(rows, row_number)) }}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt.default__validate_fixture_rows" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt.validate_sql": { + "name": "validate_sql", + "package_name": "dbt", + "path": "macros/adapters/validate_sql.sql", + "original_file_path": "macros/adapters/validate_sql.sql", + "unique_id": "macro.dbt.validate_sql", + "macro_sql": "{% macro validate_sql(sql) -%}\n {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.default__validate_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.build_snapshot_staging_table": { + "name": "build_snapshot_staging_table", + "package_name": "dbt_duckdb", + "path": "macros/snapshot_helper.sql", + "original_file_path": "macros/snapshot_helper.sql", + "unique_id": "macro.dbt_duckdb.build_snapshot_staging_table", + "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set temp_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(False, temp_relation, select) }}\n {% endcall %}\n\n {% do return(temp_relation) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.create_table_as", + "macro.dbt.make_temp_relation", + "macro.dbt.snapshot_staging_table", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.drop_indexes_on_relation": { + "name": "drop_indexes_on_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.drop_indexes_on_relation", + "macro_sql": "{% macro drop_indexes_on_relation(relation) -%}\n {% call statement('get_indexes_on_relation', fetch_result=True) %}\n SELECT index_name\n FROM duckdb_indexes()\n WHERE schema_name = '{{ relation.schema }}'\n AND table_name = '{{ relation.identifier }}'\n {% endcall %}\n\n {% set results = load_result('get_indexes_on_relation').table %}\n {% for row in results %}\n {% set index_name = row[0] %}\n {% call statement('drop_index_' + loop.index|string, auto_begin=false) %}\n DROP INDEX \"{{ relation.schema }}\".\"{{ index_name }}\"\n {% endcall %}\n {% endfor %}\n\n {#-- Verify indexes were dropped --#}\n {% call statement('verify_indexes_dropped', fetch_result=True) %}\n SELECT COUNT(*) as remaining_indexes\n FROM duckdb_indexes()\n WHERE schema_name = '{{ relation.schema }}'\n AND table_name = '{{ relation.identifier }}'\n {% endcall %}\n {% set verify_results = load_result('verify_indexes_dropped').table %}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__alter_column_comment": { + "name": "duckdb__alter_column_comment", + "package_name": "dbt_duckdb", + "path": "macros/persist_docs.sql", + "original_file_path": "macros/persist_docs.sql", + "unique_id": "macro.dbt_duckdb.duckdb__alter_column_comment", + "macro_sql": "{% macro duckdb__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 = duckdb_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 %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb_escape_comment" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__alter_relation_add_remove_columns": { + "name": "duckdb__alter_relation_add_remove_columns", + "package_name": "dbt_duckdb", + "path": "macros/columns.sql", + "original_file_path": "macros/columns.sql", + "unique_id": "macro.dbt_duckdb.duckdb__alter_relation_add_remove_columns", + "macro_sql": "{% macro duckdb__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if add_columns %}\n {% for column in add_columns %}\n {% set sql -%}\n alter {{ relation.type }} {{ relation }} add column\n {{ api.Relation.create(identifier=column.name) }} {{ column.data_type }}\n {%- endset -%}\n {% do run_query(sql) %}\n {% endfor %}\n {% endif %}\n\n {% if remove_columns %}\n {% for column in remove_columns %}\n {% set sql -%}\n alter {{ relation.type }} {{ relation }} drop column\n {{ api.Relation.create(identifier=column.name) }}\n {%- endset -%}\n {% do run_query(sql) %}\n {% endfor %}\n {% endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__alter_relation_comment": { + "name": "duckdb__alter_relation_comment", + "package_name": "dbt_duckdb", + "path": "macros/persist_docs.sql", + "original_file_path": "macros/persist_docs.sql", + "unique_id": "macro.dbt_duckdb.duckdb__alter_relation_comment", + "macro_sql": "{% macro duckdb__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = duckdb_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb_escape_comment" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__any_value": { + "name": "duckdb__any_value", + "package_name": "dbt_duckdb", + "path": "macros/utils/any_value.sql", + "original_file_path": "macros/utils/any_value.sql", + "unique_id": "macro.dbt_duckdb.duckdb__any_value", + "macro_sql": "{% macro duckdb__any_value(expression) -%}\n\n arbitrary({{ expression }})\n\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__apply_grants": { + "name": "duckdb__apply_grants", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__apply_grants", + "macro_sql": "{% macro duckdb__apply_grants(relation, grant_config, should_revoke=True) %}\n {#-- If grant_config is {} or None, this is a no-op --#}\n {% if grant_config %}\n {{ adapter.warn_once('Grants for relations are not supported by DuckDB') }}\n {% endif %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__check_for_schema_changes": { + "name": "duckdb__check_for_schema_changes", + "package_name": "dbt_duckdb", + "path": "macros/materializations/on_schema_change.sql", + "original_file_path": "macros/materializations/on_schema_change.sql", + "unique_id": "macro.dbt_duckdb.duckdb__check_for_schema_changes", + "macro_sql": "{% macro duckdb__check_for_schema_changes(source_relation, target_relation) %}\n\n {% set schema_changed = False %}\n\n {%- if model['language'] != 'python' -%}\n {%- set source_columns = get_column_schema_from_query(compiled_code) -%}\n {%- else -%}\n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- endif -%}\n\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 != [] or target_not_in_source != [] or 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 %}", + "depends_on": { + "macros": [ + "macro.dbt.diff_column_data_types", + "macro.dbt.diff_columns", + "macro.dbt.get_column_schema_from_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__check_schema_exists": { + "name": "duckdb__check_schema_exists", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__check_schema_exists", + "macro_sql": "{% macro duckdb__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from system.information_schema.schemata\n where lower(schema_name) = '{{ schema | lower }}'\n and lower(catalog_name) = '{{ information_schema.database | lower }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__create_schema": { + "name": "duckdb__create_schema", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__create_schema", + "macro_sql": "{% macro duckdb__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n {% set sql %}\n select type from duckdb_databases()\n where lower(database_name)='{{ relation.database | lower }}'\n and type='sqlite'\n {% endset %}\n {% set results = run_query(sql) %}\n {% if results|length == 0 %}\n create schema if not exists {{ relation.without_identifier() }}\n {% else %}\n {% if relation.schema!='main' %}\n {{ exceptions.raise_compiler_error(\n \"Schema must be 'main' when writing to sqlite \"\n ~ \"instead got \" ~ relation.schema\n )}}\n {% endif %}\n {% endif %}\n {%- endcall -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__create_table_as": { + "name": "duckdb__create_table_as", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__create_table_as", + "macro_sql": "{% macro duckdb__create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {# DIVERGENCE: adapter.build_catalog_relation is Fusion-only (see issue #10659).\n Under dbt-core (1.x) there is no catalog routing, so treat the target as a\n plain create-as-select target (stage-create-capable, non-iceberg). #}\n {%- set write_strategy = adapter.build_catalog_relation(config.model).duckdb_write_strategy if dbt_version.startswith('2.') else 'create_as_select' -%}\n {%- if language == 'sql' -%}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(compiled_code) }}\n {% endif %}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n {%- if not temporary and write_strategy == 'direct_create' %}\n {% if contract_config.enforced %}\n {#-- DuckDB doesnt support constraints on temp tables --#}\n create table\n {{ relation.include(database=True, schema=True) }}\n {{ get_table_columns_and_constraints() }} ;\n insert into {{ relation }} {{ get_column_names() }} (\n {{ get_select_subquery(compiled_code) }}\n );\n {% else %}\n {%- set columns = get_column_schema_from_query(compiled_code, sql_header) -%}\n {#-- These columns are derived from the SELECT, so they carry no `quote:`\n config of their own. Look the flag up by name in the model's yaml\n `columns:` block, matching `default__get_column_names`; unflagged\n columns are emitted bare rather than quoted unconditionally.\n `or {}` guards the lookups below when `columns:` is absent. --#}\n {%- set user_provided_columns = model['columns'] or {} -%}\n create table\n {{ relation.include(database=True, schema=True) }}\n (\n {% for col in columns -%}\n {%- set col_name = adapter.quote(col.name) if user_provided_columns.get(col.name, {}).get('quote') else col.name -%}\n {{ col_name }} {{ col.dtype }}{{ \",\" if not loop.last }}\n {% endfor -%}\n );\n insert into {{ relation }} (\n {% for col in columns -%}\n {%- set col_name = adapter.quote(col.name) if user_provided_columns.get(col.name, {}).get('quote') else col.name -%}\n {{ col_name }}{{ \",\" if not loop.last }}\n {% endfor -%}\n ) (\n {{ compiled_code }}\n );\n {% endif %}\n {%- else %}\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n {% if contract_config.enforced and not temporary %}\n {#-- DuckDB doesnt support constraints on temp tables --#}\n {{ get_table_columns_and_constraints() }} ;\n insert into {{ relation }} {{ get_column_names() }} (\n {{ get_select_subquery(compiled_code) }}\n );\n {% else %}\n as (\n {{ compiled_code }}\n );\n {% endif %}\n {% endif %}\n {%- elif language == 'python' -%}\n {% if not temporary and write_strategy != 'create_as_select' %}\n {% do exceptions.raise_compiler_error(\"DuckDB Python models cannot materialize to an Iceberg catalog that requires create-then-insert writes. Use a SQL model.\") %}\n {% endif %}\n {{ py_write_table(temporary=temporary, relation=relation, compiled_code=compiled_code) }}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"duckdb__create_table_as macro didn't get supported language, it got %s\" % language) %}\n {%- endif -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_assert_columns_equivalent", + "macro.dbt.get_column_schema_from_query", + "macro.dbt.get_select_subquery", + "macro.dbt.get_table_columns_and_constraints", + "macro.dbt_duckdb.get_column_names", + "macro.dbt_duckdb.py_write_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__create_view_as": { + "name": "duckdb__create_view_as", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__create_view_as", + "macro_sql": "{% macro duckdb__create_view_as(relation, sql) -%}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_assert_columns_equivalent" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__current_timestamp": { + "name": "duckdb__current_timestamp", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__current_timestamp", + "macro_sql": "{% macro duckdb__current_timestamp() -%}\n now()\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__date": { + "name": "duckdb__date", + "package_name": "dbt_duckdb", + "path": "macros/utils/date.sql", + "original_file_path": "macros/utils/date.sql", + "unique_id": "macro.dbt_duckdb.duckdb__date", + "macro_sql": "{% macro duckdb__date(year, month, day) -%}\n make_date({{ year }}, {{ month }}, {{ day }})\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__dateadd": { + "name": "duckdb__dateadd", + "package_name": "dbt_duckdb", + "path": "macros/utils/dateadd.sql", + "original_file_path": "macros/utils/dateadd.sql", + "unique_id": "macro.dbt_duckdb.duckdb__dateadd", + "macro_sql": "{% macro duckdb__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {#\n Support both literal and expression intervals (e.g., column references)\n by multiplying an INTERVAL by the value. This avoids DuckDB parser issues\n with \"interval () \" and works across versions.\n\n Also map unsupported units:\n - quarter => 3 months\n - week => 7 days (DuckDB supports WEEK as a literal, but keep it explicit)\n #}\n\n {%- set unit = datepart | lower -%}\n {%- if unit == 'quarter' -%}\n ({{ from_date_or_timestamp }} + (cast({{ interval }} as bigint) * 3) * interval 1 month)\n {%- elif unit == 'week' -%}\n ({{ from_date_or_timestamp }} + (cast({{ interval }} as bigint) * 7) * interval 1 day)\n {%- else -%}\n ({{ from_date_or_timestamp }} + cast({{ interval }} as bigint) * interval 1 {{ unit }})\n {%- endif -%}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__datediff": { + "name": "duckdb__datediff", + "package_name": "dbt_duckdb", + "path": "macros/utils/datediff.sql", + "original_file_path": "macros/utils/datediff.sql", + "unique_id": "macro.dbt_duckdb.duckdb__datediff", + "macro_sql": "{% macro duckdb__datediff(first_date, second_date, datepart) -%}\n {% if datepart == 'week' %}\n ({{ 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 {% else %}\n (date_diff('{{ datepart }}', {{ first_date }}::timestamp, {{ second_date}}::timestamp ))\n {% endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.datediff" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__drop_relation": { + "name": "duckdb__drop_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__drop_relation", + "macro_sql": "{% macro duckdb__drop_relation(relation) -%}\n {# DIVERGENCE: adapter.table_format is Fusion-only (see issue #10659). Under dbt-core\n (1.x) treat as non-iceberg/non-ducklake and always cascade. #}\n {% set fmt = adapter.table_format(relation) if dbt_version.startswith('2.') else none %}\n {% call statement('drop_relation', auto_begin=False) -%}\n {% if fmt == 'ducklake' or fmt == 'iceberg' %}\n drop {{ relation.type }} if exists {{ relation }}\n {% else %}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {% endif %}\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__drop_schema": { + "name": "duckdb__drop_schema", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__drop_schema", + "macro_sql": "{% macro duckdb__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {%- endcall -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__generate_database_name": { + "name": "duckdb__generate_database_name", + "package_name": "dbt_duckdb", + "path": "macros/get_custom_name/get_custom_database.sql", + "original_file_path": "macros/get_custom_name/get_custom_database.sql", + "unique_id": "macro.dbt_duckdb.duckdb__generate_database_name", + "macro_sql": "{% macro duckdb__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n {%- if node is not none and node|attr('database') -%}\n {%- set catalog_relation = adapter.build_catalog_relation(node) -%}\n {%- elif 'config' in target -%}\n {%- set catalog_relation = adapter.build_catalog_relation(target) -%}\n {%- else -%}\n {%- set catalog_relation = none -%}\n {%- endif -%}\n {%- if catalog_relation is not none\n and catalog_relation|attr('attached_database') -%}\n {{ return(catalog_relation.attached_database) }}\n {%- else -%}\n {{ return(default_database) }}\n {%- endif -%}\n {%- else -%}\n {{ return(custom_database_name) }}\n {%- endif -%}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__generate_series": { + "name": "duckdb__generate_series", + "package_name": "dbt_duckdb", + "path": "macros/utils/generate_series.sql", + "original_file_path": "macros/utils/generate_series.sql", + "unique_id": "macro.dbt_duckdb.duckdb__generate_series", + "macro_sql": "{% macro duckdb__generate_series(upper_bound) %}\n select\n generate_series as generated_number\n from generate_series(1, {{ upper_bound }})\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_batch_size": { + "name": "duckdb__get_batch_size", + "package_name": "dbt_duckdb", + "path": "macros/seed.sql", + "original_file_path": "macros/seed.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_batch_size", + "macro_sql": "{% macro duckdb__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_binding_char": { + "name": "duckdb__get_binding_char", + "package_name": "dbt_duckdb", + "path": "macros/seed.sql", + "original_file_path": "macros/seed.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_binding_char", + "macro_sql": "{% macro duckdb__get_binding_char() %}\n {{ return(adapter.get_binding_char()) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog": { + "name": "duckdb__get_catalog", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog", + "macro_sql": "{% macro duckdb__get_catalog(information_schema, schemas) -%}\n {% set query %}\n with tables as (\n {{ duckdb__get_catalog_tables_sql(information_schema) }}\n {{ duckdb__get_catalog_schemas_where_clause_sql(schemas) }}\n ),\n columns as (\n {{ duckdb__get_catalog_columns_sql(information_schema) }}\n {{ duckdb__get_catalog_schemas_where_clause_sql(schemas) }}\n )\n {{ duckdb__get_catalog_results_sql() }}\n {% endset %}\n\n {{ return(run_query(query)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query", + "macro.dbt_duckdb.duckdb__get_catalog_columns_sql", + "macro.dbt_duckdb.duckdb__get_catalog_results_sql", + "macro.dbt_duckdb.duckdb__get_catalog_schemas_where_clause_sql", + "macro.dbt_duckdb.duckdb__get_catalog_tables_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_columns_sql": { + "name": "duckdb__get_catalog_columns_sql", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_columns_sql", + "macro_sql": "{% macro duckdb__get_catalog_columns_sql(information_schema) -%}\n select *\n from (\n select\n c.database_name as table_database,\n c.schema_name as table_schema,\n c.table_name as table_name,\n c.column_name as column_name,\n c.column_index as column_index,\n c.data_type as column_type,\n c.comment as column_comment\n from duckdb_columns() c\n where upper(c.database_name) = upper('{{ information_schema.database }}')\n ) catalog_columns\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_relations": { + "name": "duckdb__get_catalog_relations", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_relations", + "macro_sql": "{% macro duckdb__get_catalog_relations(information_schema, relations) -%}\n {% set query %}\n with tables as (\n {{ duckdb__get_catalog_tables_sql(information_schema) }}\n {{ duckdb__get_catalog_relations_where_clause_sql(relations) }}\n ),\n columns as (\n {{ duckdb__get_catalog_columns_sql(information_schema) }}\n {{ duckdb__get_catalog_relations_where_clause_sql(relations) }}\n )\n {{ duckdb__get_catalog_results_sql() }}\n {% endset %}\n\n {{ return(run_query(query)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query", + "macro.dbt_duckdb.duckdb__get_catalog_columns_sql", + "macro.dbt_duckdb.duckdb__get_catalog_relations_where_clause_sql", + "macro.dbt_duckdb.duckdb__get_catalog_results_sql", + "macro.dbt_duckdb.duckdb__get_catalog_tables_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_relations_where_clause_sql": { + "name": "duckdb__get_catalog_relations_where_clause_sql", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_relations_where_clause_sql", + "macro_sql": "{% macro duckdb__get_catalog_relations_where_clause_sql(relations) -%}\n {% if relations | length == 0 %}\n where 1 = 0\n {% else %}\n where (\n {%- for relation in relations -%}\n {% if not relation.schema %}\n {% do exceptions.raise_compiler_error(\n '`get_catalog_relations` requires a list of relations, each with a schema'\n ) %}\n {% endif %}\n\n (\n upper(table_schema) = upper('{{ relation.schema }}')\n {%- if relation.identifier %}\n and upper(table_name) = upper('{{ relation.identifier }}')\n {%- endif %}\n ){% if not loop.last %} or {% endif %}\n {%- endfor -%}\n )\n {% endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_results_sql": { + "name": "duckdb__get_catalog_results_sql", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_results_sql", + "macro_sql": "{% macro duckdb__get_catalog_results_sql() -%}\n select\n tables.table_database,\n tables.table_schema,\n tables.table_name,\n tables.table_type,\n tables.table_comment,\n columns.column_name,\n columns.column_index,\n columns.column_type,\n columns.column_comment,\n cast(null as varchar) as table_owner\n from tables\n join columns using (table_database, table_schema, table_name)\n order by table_schema, table_name, column_index\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_schemas_where_clause_sql": { + "name": "duckdb__get_catalog_schemas_where_clause_sql", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_schemas_where_clause_sql", + "macro_sql": "{% macro duckdb__get_catalog_schemas_where_clause_sql(schemas) -%}\n {% if schemas | length == 0 %}\n where 1 = 0\n {% else %}\n where (\n {%- for schema in schemas -%}\n upper(table_schema) = upper('{{ schema }}'){% if not loop.last %} or {% endif %}\n {%- endfor -%}\n )\n {% endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_catalog_tables_sql": { + "name": "duckdb__get_catalog_tables_sql", + "package_name": "dbt_duckdb", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_catalog_tables_sql", + "macro_sql": "{% macro duckdb__get_catalog_tables_sql(information_schema) -%}\n select *\n from (\n select\n t.database_name as table_database,\n t.schema_name as table_schema,\n t.table_name as table_name,\n 'BASE TABLE' as table_type,\n t.comment as table_comment\n from duckdb_tables() t\n where upper(t.database_name) = upper('{{ information_schema.database }}')\n\n union all\n\n select\n v.database_name as table_database,\n v.schema_name as table_schema,\n v.view_name as table_name,\n 'VIEW' as table_type,\n v.comment as table_comment\n from duckdb_views() v\n where upper(v.database_name) = upper('{{ information_schema.database }}')\n ) catalog_tables\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_columns_in_relation": { + "name": "duckdb__get_columns_in_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_columns_in_relation", + "macro_sql": "{% macro duckdb__get_columns_in_relation(relation) -%}\n {# DIVERGENCE: adapter.table_format is Fusion-only (see issue #10659). Under dbt-core\n (1.x) fmt is none, so we use the standard information_schema.columns query. #}\n {% set fmt = adapter.table_format(relation) if dbt_version.startswith('2.') else none %}\n {% if fmt == 'iceberg' %}\n {# information_schema.columns returns incorrect metadata for Iceberg REST catalog tables. #}\n {% set get_columns_sql %}\n select\n column_name,\n column_type as data_type,\n null::integer as character_maximum_length,\n null::integer as numeric_precision,\n null::integer as numeric_scale\n from (describe {{ relation }})\n {% endset %}\n {% else %}\n {% set get_columns_sql %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from system.information_schema.columns\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and lower(table_schema) = '{{ relation.schema | lower }}'\n {% endif %}\n {% if relation.database %}\n and lower(table_catalog) = '{{ relation.database | lower }}'\n {% endif %}\n order by ordinal_position\n\n {% endset %}\n {% endif %}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n {{ get_columns_sql }}\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.sql_convert_columns_in_relation", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_create_index_sql": { + "name": "duckdb__get_create_index_sql", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_create_index_sql", + "macro_sql": "{% macro duckdb__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\n \"{{ index_name }}\"\n on {{ relation }}\n ({{ comma_separated_columns }});\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_delete_insert_merge_sql": { + "name": "duckdb__get_delete_insert_merge_sql", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/delete_insert.sql", + "original_file_path": "macros/materializations/incremental_strategy/delete_insert.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_delete_insert_merge_sql", + "macro_sql": "{% macro duckdb__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not string %}\n delete from {{target }} as DBT_INCREMENTAL_TARGET\n using {{ source }}\n where (\n {% for key in unique_key %}\n {{ source }}.{{ key }} = DBT_INCREMENTAL_TARGET.{{ key }}\n {{ \"and \" if not loop.last}}\n {% endfor %}\n {% if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {% endif %}\n );\n {% else %}\n delete from {{ target }}\n where (\n {{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n )\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%};\n\n {% endif %}\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_incremental_default_sql": { + "name": "duckdb__get_incremental_default_sql", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_incremental_default_sql", + "macro_sql": "{% macro duckdb__get_incremental_default_sql(arg_dict) %}\n {% do return(get_incremental_delete_insert_sql(arg_dict)) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_incremental_delete_insert_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_incremental_merge_sql": { + "name": "duckdb__get_incremental_merge_sql", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_incremental_merge_sql", + "macro_sql": "{% macro duckdb__get_incremental_merge_sql(args_dict) %}\n {%- set target_relation = args_dict['target_relation'] -%}\n {%- set temp_relation = args_dict['temp_relation'] -%}\n {%- set unique_key = args_dict['unique_key'] -%}\n {%- set dest_columns = args_dict['dest_columns'] -%}\n {%- set incremental_predicates = normalize_incremental_predicates(args_dict.get('incremental_predicates')) -%}\n\n {%- set build_sql = duckdb__get_merge_sql(target_relation, temp_relation, unique_key, dest_columns, incremental_predicates) -%}\n\n {{ return(build_sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__get_merge_sql", + "macro.dbt_duckdb.normalize_incremental_predicates" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_incremental_microbatch_sql": { + "name": "duckdb__get_incremental_microbatch_sql", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/microbatch.sql", + "original_file_path": "macros/materializations/incremental_strategy/microbatch.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_incremental_microbatch_sql", + "macro_sql": "{% macro duckdb__get_incremental_microbatch_sql(arg_dict) -%}\n {# Extract and validate required config #}\n {%- set event_time = config.get('event_time') -%}\n {%- if not event_time -%}\n {{ exceptions.raise_compiler_error(\"microbatch incremental strategy requires an 'event_time' model config\") }}\n {%- endif -%}\n\n {# microbatch is implemented as delete+insert on event_time; unique_key is ignored and misleading #}\n {%- set unique_key = config.get('unique_key') -%}\n {%- if unique_key -%}\n {{ exceptions.raise_compiler_error(\"microbatch incremental strategy does not support 'unique_key'. Microbatch runs delete+insert per batch based on 'event_time' and does not do key-based upserts. Remove 'unique_key' or use incremental_strategy='merge'.\") }}\n {%- endif -%}\n\n {# Extract batch context - dbt sets these per batch run based on lookback window #}\n {%- set batch_ctx = model.get('batch') -%}\n {%- set batch_start = batch_ctx.get('event_time_start') if batch_ctx else none -%}\n {%- set batch_end = batch_ctx.get('event_time_end') if batch_ctx else none -%}\n\n {%- if not (batch_start and batch_end) -%}\n {{ exceptions.raise_compiler_error(\"microbatch incremental strategy requires 'batch.event_time_start' and 'batch.event_time_end' to be set in the context\") }}\n {%- endif -%}\n\n {# Extract remaining arguments #}\n {%- set target = arg_dict[\"target_relation\"] -%}\n {%- set source = arg_dict[\"temp_relation\"] -%}\n {%- set dest_columns = arg_dict[\"dest_columns\"] -%}\n {%- set incremental_predicates = normalize_incremental_predicates(arg_dict.get(\"incremental_predicates\")) -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {# Build the batch time filter predicate #}\n {# batch_start and batch_end are already UTC timestamps from dbt Python code #}\n {%- set batch_predicate -%}\n {{ event_time }} >= '{{ batch_start }}'\n and {{ event_time }} < '{{ batch_end }}'\n {%- endset -%}\n\n {# Build combined WHERE clause with optional incremental predicates #}\n {%- set where_clause -%}\n {{ batch_predicate }}\n {%- for predicate in incremental_predicates %}\n and ({{ predicate }})\n {%- endfor %}\n {%- endset -%}\n\n {# Generate delete + insert SQL #}\n {%- set build_sql -%}\n delete from {{ target }}\n where {{ where_clause }};\n\n insert into {{ target }} ({{ dest_cols_csv }})\n select {{ dest_cols_csv }}\n from {{ source }}\n where {{ batch_predicate }};\n {%- endset -%}\n\n {{ return(build_sql) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv", + "macro.dbt_duckdb.normalize_incremental_predicates" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__get_merge_sql": { + "name": "duckdb__get_merge_sql", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge.sql", + "unique_id": "macro.dbt_duckdb.duckdb__get_merge_sql", + "macro_sql": "{% macro duckdb__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n {%- set predicates = normalize_incremental_predicates(incremental_predicates) -%}\n\n {{ validate_merge_config(config, target) }}\n\n {%- set sql_header = config.get('sql_header', none) -%}\n {%- set merge_on_using_columns = config.get('merge_on_using_columns', []) -%}\n {%- set merge_update_condition = config.get('merge_update_condition', none) -%}\n {%- set merge_insert_condition = config.get('merge_insert_condition', none) -%}\n {%- set merge_update_columns = config.get('merge_update_columns', []) -%}\n {%- set merge_exclude_columns = config.get('merge_exclude_columns', []) -%}\n {%- set merge_update_set_expressions = config.get('merge_update_set_expressions', {}) -%}\n {%- set merge_returning_columns = config.get('merge_returning_columns', []) -%}\n\n {%- set merge_clause_defaults = merge_clause_defaults(\n merge_update_condition,\n merge_insert_condition,\n merge_update_columns,\n merge_exclude_columns,\n merge_update_set_expressions\n ) -%}\n\n {%- set merge_clauses = config.get('merge_clauses', {}) -%}\n {%- set when_matched_clauses = merge_clauses.get('when_matched', [\n merge_clause_defaults.when_matched_update_explicit\n if (merge_update_columns|length != 0 or merge_exclude_columns|length != 0 or merge_update_set_expressions|length != 0)\n else merge_clause_defaults.when_matched_update_by_name\n ]) -%}\n\n {%- set when_not_matched_clauses = merge_clauses.get('when_not_matched', [\n merge_clause_defaults.when_not_matched_insert_by_name\n ]) -%}\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 {{ duckdb__merge_join_clause(unique_key, merge_on_using_columns, incremental_predicates) }}\n\n {%- for when_matched in when_matched_clauses %}\n WHEN MATCHED\n {%- if when_matched.get('condition') -%}\n {%- if when_matched.get('condition') is string %} AND {{ when_matched.get('condition') }}\n {%- else %} AND ({{ when_matched.get('condition') | join(') AND (') }})\n {%- endif -%}\n {%- endif %}\n THEN\n {% if when_matched.get('action') == 'update' %}\n {%- if when_matched.get('mode') == 'by_name' -%}\n UPDATE BY NAME\n {%- elif when_matched.get('mode') == 'by_position' -%}\n UPDATE BY POSITION\n {%- elif when_matched.get('mode') == 'star' -%}\n UPDATE SET *\n {%- elif when_matched.get('mode') == 'explicit' -%}\n {%- set include_columns = when_matched.get('update', {}).get('include', []) -%}\n {%- set exclude_columns = when_matched.get('update', {}).get('exclude', []) -%}\n {%- set set_expressions = when_matched.get('update', {}).get('set_expressions', {}) -%}\n\n {%- set update_columns = get_merge_update_columns(include_columns, exclude_columns, dest_columns) -%}\n\n {%- set update_columns_after_overrides = [] -%}\n {%- for column in update_columns -%}\n {%- set unquoted_column = column.replace('\"', '').replace(\"'\", \"\") -%}\n {%- if unquoted_column not in set_expressions -%}\n {%- do update_columns_after_overrides.append(column) -%}\n {%- endif -%}\n {%- endfor -%}\n\n UPDATE SET\n {% for column, expression in set_expressions.items() -%}\n {{ column }} = {{ expression }}{% if not loop.last or update_columns_after_overrides|length > 0 %}, {% endif %}\n {%- endfor %}\n {%- for column in update_columns_after_overrides -%}\n {{ column }} = DBT_INTERNAL_SOURCE.{{ column }}{% if not loop.last %}, {% endif %}\n {%- endfor %}\n {%- endif -%}\n\n {%- elif when_matched.get('action') == 'delete' %}\n DELETE\n {%- elif when_matched.get('action') == 'do_nothing' %}\n DO NOTHING\n {%- elif when_matched.get('action') == 'error' %}\n {%- set error_message = (when_matched.get('error_message', '') or '') | replace(\"'\", \"''\") -%}\n ERROR{% if when_matched.get('error_message') %} '{{ error_message }}'{% endif %}\n {%- endif %}\n {%- endfor %}\n\n {%- for when_not_matched in when_not_matched_clauses %}\n WHEN NOT MATCHED\n {% if when_not_matched.get('by') %}BY {{ when_not_matched.get('by') | upper }} {% endif %}\n {%- if when_not_matched.get('condition') -%}\n {%- if when_not_matched.get('condition') is string %} AND {{ when_not_matched.get('condition') }}\n {%- else %} AND ({{ when_not_matched.get('condition') | join(') AND (') }})\n {%- endif -%}\n {%- endif %}\n THEN\n {% if when_not_matched.get('action') == 'update' %}\n {%- set set_expressions = when_not_matched.get('set_expressions', {}) -%}\n\n UPDATE SET\n {% for column, expression in set_expressions.items() -%}\n {{ column }} = {{ expression }}{% if not loop.last %}, {% endif %}\n {%- endfor %}\n\n {%- elif when_not_matched.get('action') == 'insert' %}\n {%- if when_not_matched.get('mode') == 'by_name' -%}\n INSERT BY NAME\n {%- elif when_not_matched.get('mode') == 'by_position' -%}\n INSERT BY POSITION\n {%- elif when_not_matched.get('mode') == 'star' -%}\n INSERT *\n {%- elif when_not_matched.get('mode') == 'explicit' -%}\n {%- set insert_columns = when_not_matched.get('insert', {}).get('columns', []) -%}\n {%- set insert_values = when_not_matched.get('insert', {}).get('values', []) -%}\n\n INSERT\n ({{ insert_columns | join(', ') }})\n VALUES ({{ insert_values | join(', ') }})\n {%- endif -%}\n {%- elif when_not_matched.get('action') == 'delete' %}\n DELETE\n {%- elif when_not_matched.get('action') == 'do_nothing' %}\n DO NOTHING\n {%- elif when_not_matched.get('action') == 'error' %}\n {%- set error_message = (when_not_matched.get('error_message', '') or '') | replace(\"'\", \"''\") -%}\n ERROR{% if when_not_matched.get('error_message') %} '{{ error_message }}'{% endif %}\n {%- endif %}\n {%- endfor %}\n\n {%- if merge_returning_columns %}\n RETURNING {{ merge_returning_columns if merge_returning_columns is string else merge_returning_columns | join(', ') }}\n {%- endif %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_merge_update_columns", + "macro.dbt_duckdb.duckdb__merge_join_clause", + "macro.dbt_duckdb.merge_clause_defaults", + "macro.dbt_duckdb.normalize_incremental_predicates", + "macro.dbt_duckdb.validate_merge_config" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__last_day": { + "name": "duckdb__last_day", + "package_name": "dbt_duckdb", + "path": "macros/utils/lastday.sql", + "original_file_path": "macros/utils/lastday.sql", + "unique_id": "macro.dbt_duckdb.duckdb__last_day", + "macro_sql": "{% macro duckdb__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- duckdb dateadd does not support quarter interval.\n cast(\n {{dbt.dateadd('day', '-1',\n dbt.dateadd('month', '3', dbt.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.date_trunc", + "macro.dbt.dateadd", + "macro.dbt.default_last_day" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__list_relations_without_caching": { + "name": "duckdb__list_relations_without_caching", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__list_relations_without_caching", + "macro_sql": "{% macro duckdb__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 table_name as name,\n table_schema as schema,\n CASE table_type\n WHEN 'BASE TABLE' THEN 'table'\n WHEN 'VIEW' THEN 'view'\n WHEN 'LOCAL TEMPORARY' THEN 'table'\n END as type\n from system.information_schema.tables\n where lower(table_schema) = '{{ schema_relation.schema | lower }}'\n and lower(table_catalog) = '{{ schema_relation.database | lower }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__list_schemas": { + "name": "duckdb__list_schemas", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__list_schemas", + "macro_sql": "{% macro duckdb__list_schemas(database) -%}\n {% set sql %}\n select schema_name\n from system.information_schema.schemata\n {% if database is not none %}\n where lower(catalog_name) = '{{ database | lower }}'\n {% endif %}\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__listagg": { + "name": "duckdb__listagg", + "package_name": "dbt_duckdb", + "path": "macros/utils/listagg.sql", + "original_file_path": "macros/utils/listagg.sql", + "unique_id": "macro.dbt_duckdb.duckdb__listagg", + "macro_sql": "{% macro duckdb__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n {% if limit_num -%}\n list_aggr(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n 'string_agg',\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__load_csv_rows": { + "name": "duckdb__load_csv_rows", + "package_name": "dbt_duckdb", + "path": "macros/seed.sql", + "original_file_path": "macros/seed.sql", + "unique_id": "macro.dbt_duckdb.duckdb__load_csv_rows", + "macro_sql": "{% macro duckdb__load_csv_rows(model, agate_table) %}\n {% if config.get('fast', true) %}\n {% set seed_file_path = adapter.get_seed_file_path(model) %}\n {% set delimiter = config.get('delimiter', ',') %}\n {% set sql %}\n COPY {{ this.render() }} FROM '{{ seed_file_path }}' (FORMAT CSV, HEADER TRUE, DELIMITER '{{ delimiter }}')\n {% endset %}\n {% do adapter.add_query(sql, abridge_sql_log=True) %}\n {{ return(sql) }}\n {% endif %}\n\n {% set batch_size = get_batch_size() %}\n {% set agate_table = adapter.convert_datetimes_to_strs(agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ 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 %}", + "depends_on": { + "macros": [ + "macro.dbt.get_batch_size", + "macro.dbt.get_binding_char", + "macro.dbt.get_seed_column_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__make_temp_relation": { + "name": "duckdb__make_temp_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__make_temp_relation", + "macro_sql": "{% macro duckdb__make_temp_relation(base_relation, suffix) %}\n {% set suffix = adapter.generate_unique_temporary_table_suffix(suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__merge_join_clause": { + "name": "duckdb__merge_join_clause", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge.sql", + "unique_id": "macro.dbt_duckdb.duckdb__merge_join_clause", + "macro_sql": "{% macro duckdb__merge_join_clause(unique_key, merge_on_using_columns, incremental_predicates) -%}\n {%- set incremental_filters = [] if incremental_predicates is none else [] + incremental_predicates -%}\n {%- set join_predicates = [] -%}\n {%- set using_clause_requested = merge_on_using_columns and merge_on_using_columns | length > 0 -%}\n\n {%- if not using_clause_requested -%}\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n {% for key in unique_key %}\n {% do join_predicates.append(\"DBT_INTERNAL_SOURCE.\" ~ key ~ \" = DBT_INTERNAL_DEST.\" ~ key) %}\n {% endfor %}\n {% else %}\n {% do join_predicates.append(\"DBT_INTERNAL_SOURCE.\" ~ unique_key ~ \" = DBT_INTERNAL_DEST.\" ~ unique_key) %}\n {% endif %}\n {% else %}\n {% do join_predicates.append('FALSE') %}\n {% endif %}\n {%- endif -%}\n\n {% if using_clause_requested %}\n USING ({{ merge_on_using_columns | join(', ') }})\n {%- if incremental_filters | length > 0 %}\n ON ({{ incremental_filters | join(\") AND (\") }})\n {%- endif %}\n {% else %}\n ON ({{ (join_predicates + incremental_filters) | join(\") AND (\") }})\n {% endif %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__post_snapshot": { + "name": "duckdb__post_snapshot", + "package_name": "dbt_duckdb", + "path": "macros/snapshot_helper.sql", + "original_file_path": "macros/snapshot_helper.sql", + "unique_id": "macro.dbt_duckdb.duckdb__post_snapshot", + "macro_sql": "{% macro duckdb__post_snapshot(staging_relation) %}\n {% do return(drop_relation(staging_relation)) %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.drop_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__rename_relation": { + "name": "duckdb__rename_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__rename_relation", + "macro_sql": "{% macro duckdb__rename_relation(from_relation, to_relation) -%}\n {# DIVERGENCE: adapter.table_format is Fusion-only (see issue #10659). Under dbt-core\n (1.x) fmt is none, so auto_begin stays on and we just ALTER RENAME. #}\n {% set fmt = adapter.table_format(from_relation) if dbt_version.startswith('2.') else none %}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {# Iceberg REST: ALTER...RENAME must not share a transaction with the prior CTAS.\n DuckDB autocommits each statement, so for iceberg we run the rename standalone\n (auto_begin=False) rather than committing the connection \u2014 which in Fusion is a\n resource shared across nodes and must not be mutated mid-DAG. #}\n {% call statement('rename_relation', auto_begin=(fmt != 'iceberg')) -%}\n alter {{ to_relation.type }} {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__snapshot_get_time": { + "name": "duckdb__snapshot_get_time", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__snapshot_get_time", + "macro_sql": "{% macro duckdb__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__snapshot_merge_sql": { + "name": "duckdb__snapshot_merge_sql", + "package_name": "dbt_duckdb", + "path": "macros/snapshot_helper.sql", + "original_file_path": "macros/snapshot_helper.sql", + "unique_id": "macro.dbt_duckdb.duckdb__snapshot_merge_sql", + "macro_sql": "{% macro duckdb__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n {%- set columns = config.get(\"snapshot_table_column_names\") or get_snapshot_table_column_names() -%}\n\n update {{ target }} as DBT_INTERNAL_TARGET\n set {{ columns.dbt_valid_to }} = DBT_INTERNAL_SOURCE.{{ columns.dbt_valid_to }}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }}::text = DBT_INTERNAL_TARGET.{{ columns.dbt_scd_id }}::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n {% if config.get(\"dbt_valid_to_current\") %}\n and (DBT_INTERNAL_TARGET.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }} or DBT_INTERNAL_TARGET.{{ columns.dbt_valid_to }} is null);\n {% else %}\n and DBT_INTERNAL_TARGET.{{ columns.dbt_valid_to }} is null;\n {% endif %}\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\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.get_snapshot_table_column_names" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__snapshot_string_as_time": { + "name": "duckdb__snapshot_string_as_time", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.duckdb__snapshot_string_as_time", + "macro_sql": "{% macro duckdb__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp\" -%}\n {{ return(result) }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb__split_part": { + "name": "duckdb__split_part", + "package_name": "dbt_duckdb", + "path": "macros/utils/splitpart.sql", + "original_file_path": "macros/utils/splitpart.sql", + "unique_id": "macro.dbt_duckdb.duckdb__split_part", + "macro_sql": "{% macro duckdb__split_part(string_text, delimiter_text, part_number) %}\n string_split({{ string_text }}, {{ delimiter_text }})[ {{ part_number }} ]\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.duckdb_escape_comment": { + "name": "duckdb_escape_comment", + "package_name": "dbt_duckdb", + "path": "macros/persist_docs.sql", + "original_file_path": "macros/persist_docs.sql", + "unique_id": "macro.dbt_duckdb.duckdb_escape_comment", + "macro_sql": "{% macro duckdb_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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.external_location": { + "name": "external_location", + "package_name": "dbt_duckdb", + "path": "macros/utils/external_location.sql", + "original_file_path": "macros/utils/external_location.sql", + "unique_id": "macro.dbt_duckdb.external_location", + "macro_sql": "{%- macro external_location(relation, config) -%}\n {%- set catalog_relation = adapter.build_catalog_relation(model) -%}\n {%- set external_root = adapter.external_root() -%}\n {%- if catalog_relation is not none and catalog_relation|attr('external_root') -%}\n {%- set external_root = catalog_relation.external_root -%}\n {%- endif -%}\n {%- if config.get('options', {}).get('partition_by') is none -%}\n {%- set format = config.get('format', none) -%}\n {%- if format is none and catalog_relation is not none and catalog_relation|attr('file_format') -%}\n {%- set format = catalog_relation.file_format -%}\n {%- endif -%}\n {%- if format is none -%}\n {%- set format = 'parquet' -%}\n {%- endif -%}\n {{- external_root }}/{{ relation.identifier }}.{{ format }}\n {%- else -%}\n {{- external_root }}/{{ relation.identifier }}\n {%- endif -%}\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.get_column_names": { + "name": "get_column_names", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.get_column_names", + "macro_sql": "{% macro get_column_names() %}\n {# loop through user_provided_columns to get column names #}\n {%- set user_provided_columns = model['columns'] -%}\n (\n {% for i in user_provided_columns %}\n {% set col = user_provided_columns[i] %}\n {{ col['name'] }} {{ \",\" if not loop.last }}\n {% endfor %}\n )\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.location_exists": { + "name": "location_exists", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.location_exists", + "macro_sql": "{% macro location_exists(location) -%}\n {% do return(adapter.location_exists(location)) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.materialization_external_duckdb": { + "name": "materialization_external_duckdb", + "package_name": "dbt_duckdb", + "path": "macros/materializations/external.sql", + "original_file_path": "macros/materializations/external.sql", + "unique_id": "macro.dbt_duckdb.materialization_external_duckdb", + "macro_sql": "{% materialization external, adapter=\"duckdb\", supported_languages=['sql', 'python'] %}\n\n {%- set location = render(config.get('location', default=external_location(this, config))) -%}\n {%- set rendered_options = render_write_options(config) -%}\n\n {%- set format = config.get('format') -%}\n {%- set allowed_formats = ['csv', 'parquet', 'json'] -%}\n {%- if format -%}\n {%- if format not in allowed_formats -%}\n {{ exceptions.raise_compiler_error(\"Invalid format: \" ~ format ~ \". Allowed formats are: \" ~ allowed_formats | join(', ')) }}\n {%- endif -%}\n {%- else -%}\n {%- set format = location.split('.')[-1].lower() if '.' in location else 'parquet' -%}\n {%- set format = format if format in allowed_formats else 'parquet' -%}\n {%- endif -%}\n\n {%- set write_options = adapter.external_write_options(location, rendered_options) -%}\n {%- set read_location = adapter.external_read_location(location, rendered_options) -%}\n {%- set parquet_read_options = config.get('parquet_read_options', {'union_by_name': False}) -%}\n {%- set json_read_options = config.get('json_read_options', {'auto_detect': True}) -%}\n {%- set csv_read_options = config.get('csv_read_options', {'auto_detect': True}) -%}\n\n -- set language - python or sql\n {%- set language = model['language'] -%}\n\n {%- set target_relation = this.incorporate(type='view') %}\n\n -- Continue as normal materialization\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set temp_relation = make_intermediate_relation(this.incorporate(type='table'), suffix='__dbt_tmp') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation, suffix='__dbt_int') -%}\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_temp_relation = load_cached_relation(temp_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\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_temp_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('create_table', language=language) -%}\n {{- create_table_as(False, temp_relation, compiled_code, language) }}\n {%- endcall %}\n\n -- check if relation is empty\n {%- set count_query -%}\n select count(*) as row_count from {{ temp_relation }}\n {%- endset -%}\n {%- set row_count = run_query(count_query) -%}\n\n -- if relation is empty, write a non-empty table with column names and null values\n {% call statement('main', language='sql') -%}\n {% if row_count[0][0] == 0 %}\n insert into {{ temp_relation }} values (\n {%- for col in get_columns_in_relation(temp_relation) -%}\n NULL,\n {%- endfor -%}\n )\n {% endif %}\n {%- endcall %}\n\n -- write a temp relation into file\n {{ write_to_file(temp_relation, location, write_options) }}\n\n-- create a view on top of the location\n {% call statement('main', language='sql') -%}\n {% if format == 'json' %}\n create or replace view {{ intermediate_relation }} as (\n select * from read_json('{{ read_location }}'\n {%- for key, value in json_read_options.items() -%}\n , {{ key }}=\n {%- if value is string -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- endfor -%}\n )\n -- if relation is empty, filter by all columns having null values\n {% if row_count[0][0] == 0 %}\n where 1\n {%- for col in get_columns_in_relation(temp_relation) -%}\n {{ '' }} AND \"{{ col.column }}\" is not NULL\n {%- endfor -%}\n {% endif %}\n );\n {% elif format == 'parquet' %}\n create or replace view {{ intermediate_relation }} as (\n select * from read_parquet('{{ read_location }}'\n {%- for key, value in parquet_read_options.items() -%}\n , {{ key }}=\n {%- if value is string -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- endfor -%}\n )\n -- if relation is empty, filter by all columns having null values\n {% if row_count[0][0] == 0 %}\n where 1\n {%- for col in get_columns_in_relation(temp_relation) -%}\n {{ '' }} AND \"{{ col.column }}\" is not NULL\n {%- endfor -%}\n {% endif %}\n );\n {% elif format == 'csv' %}\n create or replace view {{ intermediate_relation }} as (\n select * from read_csv('{{ read_location }}'\n {%- for key, value in csv_read_options.items() -%}\n , {{ key }}=\n {%- if value is string -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- endfor -%}\n )\n -- if relation is empty, filter by all columns having null values\n {% if row_count[0][0] == 0 %}\n where 1\n {%- for col in get_columns_in_relation(temp_relation) -%}\n {{ '' }} AND \"{{ col.column }}\" is not NULL\n {%- endfor -%}\n {% endif %}\n );\n {% endif %}\n {%- endcall %}\n\n -- cleanup\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 {{ drop_relation_if_exists(temp_relation) }}\n\n -- register table into glue\n {%- set plugin_name = config.get('plugin') -%}\n {%- set glue_register = config.get('glue_register', default=false) -%}\n {%- set partition_columns = config.get('partition_columns', []) -%}\n {% if plugin_name is not none or glue_register is true %}\n {% if glue_register %}\n {# legacy hack to set the glue database name, deprecate this #}\n {%- set plugin_name = 'glue|' ~ config.get('glue_database', 'default') -%}\n {% endif %}\n {% do store_relation(plugin_name, target_relation, location, format, config) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_table_as", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.get_columns_in_relation", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.persist_docs", + "macro.dbt.run_query", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.external_location", + "macro.dbt_duckdb.render_write_options", + "macro.dbt_duckdb.run_hooks", + "macro.dbt_duckdb.store_relation", + "macro.dbt_duckdb.write_to_file" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "supported_languages": [ + "sql", + "python" + ], + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.materialization_incremental_duckdb": { + "name": "materialization_incremental_duckdb", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental.sql", + "original_file_path": "macros/materializations/incremental.sql", + "unique_id": "macro.dbt_duckdb.materialization_incremental_duckdb", + "macro_sql": "{% materialization incremental, adapter=\"duckdb\", supported_languages=['sql', 'python'] -%}\n\n {%- set language = model['language'] -%}\n -- only create temp tables if using local duckdb, as it is not currently supported for remote databases\n {# DIVERGENCE: Fusion uses adapter.has_feature(\"motherduck\"); v1 dbt-duckdb exposes\n adapter.is_motherduck. Gate on dbt_version. #}\n {%- if dbt_version.startswith('2.') -%}\n {%- set temporary = not adapter.has_feature(\"motherduck\") -%}\n {%- else -%}\n {%- set temporary = not adapter.is_motherduck() -%}\n {%- endif -%}\n\n -- relations\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n -- configs\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}\n {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n -- the temp_ 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 = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {% set to_drop = [] %}\n {% if not temporary %}\n -- if not using a temporary table we will update the temp relation to use a different temp schema (\"dbt_temp\" by default)\n -- for microbatch with concurrent batches, include batch timestamps in the identifier to avoid collisions\n {%- set batch_id = '' -%}\n {%- set batch_ctx = model.get('batch') -%}\n {%- if batch_ctx and batch_ctx.get('event_time_start') -%}\n {%- set batch_id = batch_ctx.get('event_time_start') | string | replace('-', '') | replace(':', '') | replace(' ', '_') | replace('+', '') -%}\n {%- endif -%}\n {% set temp_relation = temp_relation.incorporate(path=adapter.get_temp_relation_path(this, batch_id)) %}\n {% do run_query(create_schema(temp_relation)) %}\n {# DIVERGENCE: Fusion uses adapter.has_feature(\"transactions\"); v1 dbt-duckdb exposes\n adapter.disable_transactions (note inverted polarity). Gate on dbt_version. #}\n {% if (dbt_version.startswith('2.') and adapter.has_feature(\"transactions\"))\n or (not dbt_version.startswith('2.') and not adapter.disable_transactions()) %}\n {% do adapter.commit() %}\n {% endif %}\n -- then drop the temp relation after we insert the incremental data into the target relation\n {% do to_drop.append(temp_relation) %}\n {% endif %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, compiled_code, language) %}\n {% elif full_refresh_mode %}\n {% set build_sql = create_table_as(False, intermediate_relation, compiled_code, language) %}\n {% set need_swap = true %}\n {% else %}\n {% if language == 'python' %}\n {% set build_python = create_table_as(temporary, temp_relation, compiled_code, language) %}\n {% call statement(\"pre\", language=language) %}\n {{- build_python }}\n {% endcall %}\n {% endif %}\n\n {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n {% set language = \"sql\" %}\n\n {#-- Emit CREATE TEMP TABLE + strategy as ONE multi-statement batch.\n DuckDB does not split on ';', so the entire batch runs in a single execute() call\n on one connection, ensuring the temp table is visible to the subsequent DML. --#}\n {% set create_tmp_sql = create_table_as(temporary, temp_relation, compiled_code) %}\n {% set build_sql = create_tmp_sql ~ \";\\n\" ~ build_sql %}\n\n {% endif %}\n\n {% call statement(\"main\", language=language) %}\n {{- build_sql }}\n {% endcall %}\n\n {% if need_swap %}\n {#-- Drop indexes on target relation before renaming to backup to avoid dependency errors --#}\n {% do drop_indexes_on_relation(target_relation) %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% do to_drop.append(backup_relation) %}\n {% endif %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {# Align order with table materialization to avoid MotherDuck alter conflicts #}\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 {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {# On MotherDuck the temp relation is a real table; dropping it cascades indexes. Avoid extra ALTERs.\n DIVERGENCE: Fusion uses adapter.has_feature(\"motherduck\"); v1 uses adapter.is_motherduck. #}\n {% set _is_motherduck = adapter.has_feature(\"motherduck\") if dbt_version.startswith('2.') else adapter.is_motherduck() %}\n {% if not _is_motherduck %}\n {% do drop_indexes_on_relation(rel) %}\n {% endif %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_indexes", + "macro.dbt.create_schema", + "macro.dbt.create_table_as", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.incremental_validate_on_schema_change", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.make_temp_relation", + "macro.dbt.persist_docs", + "macro.dbt.process_schema_changes", + "macro.dbt.run_query", + "macro.dbt.should_full_refresh", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.drop_indexes_on_relation", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "supported_languages": [ + "sql", + "python" + ], + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.materialization_table_duckdb": { + "name": "materialization_table_duckdb", + "package_name": "dbt_duckdb", + "path": "macros/materializations/table.sql", + "original_file_path": "macros/materializations/table.sql", + "unique_id": "macro.dbt_duckdb.materialization_table_duckdb", + "macro_sql": "{% materialization table, adapter=\"duckdb\", supported_languages=['sql', 'python'] %}\n\n {%- set language = model['language'] -%}\n\n {%- set target_relation = this.incorporate(type='table') %}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n {# DIVERGENCE: adapter.build_catalog_relation is Fusion-only (see issue #10659). Under\n dbt-core (1.x) there is no iceberg table-format routing, so use the standard temp+rename flow. #}\n {% set use_direct_create = (adapter.build_catalog_relation(config.model).duckdb_write_strategy in ['direct_create', 'direct_create_as_select']) if dbt_version.startswith('2.') else false %}\n {%- set existing_relation = none if use_direct_create else load_cached_relation(this) -%}\n {%- set intermediate_relation = target_relation if use_direct_create else make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = none if use_direct_create else load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = none if use_direct_create else make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = none if use_direct_create else load_cached_relation(backup_relation) -%}\n\n {% if use_direct_create %}\n {# Iceberg REST catalogs do not support the temp-table + rename flow. #}\n {{ adapter.drop_relation(target_relation) }}\n {% else %}\n -- the intermediate and backup relations should not already exist in the\n -- database (load_cached_relation returned none above if so); otherwise they\n -- hold leftovers we must drop before reusing their names for this operation\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {% endif %}\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', language=language) -%}\n {{- create_table_as(False, intermediate_relation, compiled_code, language) }}\n {%- endcall %}\n\n {% if not use_direct_create and existing_relation is not none %}\n {#-- Drop indexes before renaming to avoid dependency errors --#}\n {% do drop_indexes_on_relation(existing_relation) %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n\n {% if not use_direct_create %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n {% endif %}\n\n {% if not use_direct_create %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {% if not use_direct_create %}\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.apply_grants", + "macro.dbt.create_indexes", + "macro.dbt.create_table_as", + "macro.dbt.drop_relation_if_exists", + "macro.dbt.load_cached_relation", + "macro.dbt.make_backup_relation", + "macro.dbt.make_intermediate_relation", + "macro.dbt.persist_docs", + "macro.dbt.should_revoke", + "macro.dbt.statement", + "macro.dbt_duckdb.drop_indexes_on_relation", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "supported_languages": [ + "sql", + "python" + ], + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.materialization_table_function_duckdb": { + "name": "materialization_table_function_duckdb", + "package_name": "dbt_duckdb", + "path": "macros/materializations/table_function.sql", + "original_file_path": "macros/materializations/table_function.sql", + "unique_id": "macro.dbt_duckdb.materialization_table_function_duckdb", + "macro_sql": "{% materialization table_function, adapter='duckdb' %}\n -- This materialization uses DuckDB's Table Function / Table Macro feature to provide parameterized views.\n -- Why use this?\n -- Late binding of functions means that the underlying table can change (have new columns added), and\n -- the function does not need to be recreated. (With a view, the create view statement would need to be re-run).\n -- This allows for skipping parts of the dbt DAG, even if the underlying table changed.\n -- Parameters can force filter pushdown\n -- Functions can provide advanced features like dynamic SQL (the query and query_table functions)\n\n -- For usage examples, see the tests at /dbt-duckdb/tests/functional/adapter/test_table_function.py\n -- (Don't forget parentheses when you pull from a table_function!)\n\n -- Using Redshift as an example:\n -- https://github.com/dbt-labs/dbt-adapters/blob/main/dbt-redshift/src/dbt/include/redshift/macros/materializations/table.sql\n {%- set identifier = model['alias'] -%}\n {%- set target_relation = api.Relation.create(\n identifier=identifier,\n schema=schema,\n database=database,\n type='view') -%}\n {%- set backup_relation = none -%}\n\n -- The parameters config is used to pass in the names of the parameters that will be used within the table function.\n -- parameters can be a single string value (with or without commas), or a list of strings.\n {%- set parameters=config.get('parameters') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- Create or replace the function (macro)\n -- By using create or replace (and a transaction), we do not need an old version and new version.\n {% call statement('main') -%}\n create or replace function {{ target_relation.render() }}(\n {% if not parameters %}\n {% elif parameters is string or parameters is number %}\n {{ parameters if parameters }}\n {% else %}\n {{ parameters|join(', ') }}\n {% endif %}\n ) as table (\n {{ sql }});\n {%- endcall %}\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 {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "depends_on": { + "macros": [ + "macro.dbt.persist_docs", + "macro.dbt.statement", + "macro.dbt_duckdb.run_hooks" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.merge_clause_defaults": { + "name": "merge_clause_defaults", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge_defaults.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge_defaults.sql", + "unique_id": "macro.dbt_duckdb.merge_clause_defaults", + "macro_sql": "{% macro merge_clause_defaults(\n merge_update_condition,\n merge_insert_condition,\n merge_update_columns=[],\n merge_exclude_columns=[],\n merge_update_set_expressions={}\n) -%}\n\n {{ return({\n 'when_matched_update_by_name': {\n 'action': 'update',\n 'condition': merge_update_condition,\n 'mode': 'by_name'\n },\n 'when_not_matched_insert_by_name': {\n 'action': 'insert',\n 'condition': merge_insert_condition,\n 'mode': 'by_name'\n },\n 'when_matched_update_explicit': {\n 'action': 'update',\n 'condition': merge_update_condition,\n 'mode': 'explicit',\n 'update': {\n 'include': merge_update_columns,\n 'exclude': merge_exclude_columns,\n 'set_expressions': merge_update_set_expressions\n }\n }\n }) }}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.normalize_incremental_predicates": { + "name": "normalize_incremental_predicates", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/validation_helper.sql", + "original_file_path": "macros/materializations/incremental_strategy/validation_helper.sql", + "unique_id": "macro.dbt_duckdb.normalize_incremental_predicates", + "macro_sql": "{%- macro normalize_incremental_predicates(incremental_predicates) -%}\n {%- if incremental_predicates is none -%}\n {%- set incremental_predicates = [] -%}\n {%- elif incremental_predicates is mapping -%}\n {{ exceptions.raise_compiler_error(\"incremental_predicates must be a list of strings or a string\") }}\n {%- elif incremental_predicates is string -%}\n {%- set incremental_predicates = [incremental_predicates] -%}\n {%- elif incremental_predicates is sequence -%}\n {%- set incremental_predicates = incremental_predicates | list -%}\n {%- else -%}\n {{ exceptions.raise_compiler_error(\"incremental_predicates must be a list of strings or a string\") }}\n {%- endif -%}\n {{ return(incremental_predicates) }}\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.py_write_table": { + "name": "py_write_table", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.py_write_table", + "macro_sql": "{% macro py_write_table(temporary, relation, compiled_code) -%}\n{{ compiled_code }}\n\ndef materialize(df, con):\n try:\n import pyarrow\n pyarrow_available = True\n except ImportError:\n pyarrow_available = False\n finally:\n if pyarrow_available and isinstance(df, pyarrow.Table):\n # https://github.com/duckdb/duckdb/issues/6584\n import pyarrow.dataset\n tmp_name = '__dbt_python_model_df_' + '{{ relation.identifier }}'\n con.register(tmp_name, df)\n con.execute('create table {{ relation }} as select * from ' + tmp_name)\n con.unregister(tmp_name)\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.register_upstream_external_models": { + "name": "register_upstream_external_models", + "package_name": "dbt_duckdb", + "path": "macros/utils/upstream.sql", + "original_file_path": "macros/utils/upstream.sql", + "unique_id": "macro.dbt_duckdb.register_upstream_external_models", + "macro_sql": "{%- macro register_upstream_external_models() -%}\n{% if execute %}\n{% set upstream_nodes = {} %}\n{% set upstream_schemas = {} %}\n{% for node in selected_resources %}\n {% if node not in graph['nodes'] %}{% continue %}{% endif %}\n {% for upstream_node in graph['nodes'][node]['depends_on']['nodes'] %}\n {% if upstream_node not in upstream_nodes and upstream_node not in selected_resources %}\n {% do upstream_nodes.update({upstream_node: None}) %}\n {% set upstream = graph['nodes'].get(upstream_node) %}\n {% if upstream\n and upstream.resource_type in ('model', 'seed')\n and upstream.config.materialized=='external'\n %}\n {%- set upstream_rel = api.Relation.create(\n database=upstream['database'],\n schema=upstream['schema'],\n identifier=upstream['alias']\n ) -%}\n {%- set location = upstream.config.get('location', external_location(upstream_rel, upstream.config)) -%}\n {%- set rendered_options = render_write_options(upstream.config) -%}\n {%- set upstream_location = adapter.external_read_location(location, rendered_options) -%}\n {% if upstream_rel.schema not in upstream_schemas %}\n {% call statement('main', language='sql') -%}\n create schema if not exists {{ upstream_rel.without_identifier() }}\n {%- endcall %}\n {% do upstream_schemas.update({upstream_rel.schema: None}) %}\n {% endif %}\n {% call statement('main', language='sql') -%}\n create or replace view {{ upstream_rel }} as (\n select * from '{{ upstream_location }}'\n );\n {%- endcall %}\n {%- endif %}\n {% endif %}\n {% endfor %}\n{% endfor %}\n{% if upstream_schemas %}\n {% do adapter.commit() %}\n{% endif %}\n{% endif %}\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt_duckdb.external_location", + "macro.dbt_duckdb.render_write_options" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.render_write_options": { + "name": "render_write_options", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.render_write_options", + "macro_sql": "{% macro render_write_options(config) -%}\n {% set options = config.get('options', {}) %}\n {% if options is not mapping %}\n {% do exceptions.raise_compiler_error(\"The options argument must be a dictionary\") %}\n {% endif %}\n\n {% for k in options %}\n {% set _ = options.update({k: render(options[k])}) %}\n {% endfor %}\n\n {# legacy top-level write options #}\n {% if config.get('format') %}\n {% set _ = options.update({'format': render(config.get('format'))}) %}\n {% endif %}\n {% if config.get('delimiter') %}\n {% set _ = options.update({'delimiter': render(config.get('delimiter'))}) %}\n {% endif %}\n\n {% do return(options) %}\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.run_hooks": { + "name": "run_hooks", + "package_name": "dbt_duckdb", + "path": "macros/materializations/hooks.sql", + "original_file_path": "macros/materializations/hooks.sql", + "unique_id": "macro.dbt_duckdb.run_hooks", + "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.store_relation": { + "name": "store_relation", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.store_relation", + "macro_sql": "{% macro store_relation(plugin, relation, location, format, config) -%}\n {%- set column_list = adapter.get_columns_in_relation(relation) -%}\n {% do adapter.store_relation(plugin, relation, column_list, location, format, config) %}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_dict_field": { + "name": "validate_dict_field", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/validation_helper.sql", + "original_file_path": "macros/materializations/incremental_strategy/validation_helper.sql", + "unique_id": "macro.dbt_duckdb.validate_dict_field", + "macro_sql": "{%- macro validate_dict_field(field_value, field_name, errors) -%}\n {%- if field_value is not none and field_value is not mapping -%}\n {%- do errors.append(field_name ~ \" must be a dictionary, found: \" ~ field_value) -%}\n {%- endif -%}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_ducklake_restrictions": { + "name": "validate_ducklake_restrictions", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "unique_id": "macro.dbt_duckdb.validate_ducklake_restrictions", + "macro_sql": "{%- macro validate_ducklake_restrictions(config, target_relation, errors) -%}\n {%- if target_relation and adapter.is_ducklake(target_relation) -%}\n {%- set merge_clauses = config.get('merge_clauses', {}) -%}\n {%- if merge_clauses and 'when_matched' in merge_clauses -%}\n {%- set when_matched_clauses = merge_clauses.get('when_matched', []) -%}\n {%- set update_delete_count = 0 -%}\n\n {%- for clause in when_matched_clauses -%}\n {%- if clause is mapping and clause.get('action') in ['update', 'delete'] -%}\n {%- set update_delete_count = update_delete_count + 1 -%}\n {%- endif -%}\n {%- endfor -%}\n\n {%- if update_delete_count > 1 -%}\n {%- do errors.append(\"DuckLake MERGE restrictions: when_matched clauses can contain only a single UPDATE or DELETE action. Found \" ~ update_delete_count ~ \" UPDATE/DELETE actions. DuckLake currently supports only one UPDATE or DELETE operation per MERGE statement.\") -%}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_merge_clause_list": { + "name": "validate_merge_clause_list", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "unique_id": "macro.dbt_duckdb.validate_merge_clause_list", + "macro_sql": "{%- macro validate_merge_clause_list(merge_clauses, clause_type, errors) -%}\n {%- if merge_clauses.get(clause_type) is not sequence or merge_clauses.get(clause_type) is mapping or merge_clauses.get(clause_type) is string -%}\n {%- do errors.append(\"merge_clauses.\" ~ clause_type ~ \" must be a list\") -%}\n {%- elif merge_clauses.get(clause_type)|length == 0 -%}\n {%- do errors.append(\"merge_clauses.\" ~ clause_type ~ \" must contain at least one element\") -%}\n {%- else -%}\n {%- for clause in merge_clauses.get(clause_type) -%}\n {%- if clause is not mapping -%}\n {%- do errors.append(\"merge_clauses.\" ~ clause_type ~ \" elements must be dictionaries, found: \" ~ clause) -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_merge_clauses": { + "name": "validate_merge_clauses", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "unique_id": "macro.dbt_duckdb.validate_merge_clauses", + "macro_sql": "{%- macro validate_merge_clauses(config, base_configuration_fields, errors) -%}\n {%- if config.get('merge_clauses') is not none -%}\n {%- if config.get('merge_clauses') is not mapping -%}\n {%- do errors.append(\"merge_clauses must be a dictionary, found: \" ~ config.get('merge_clauses')) -%}\n {%- else -%}\n {%- set merge_clauses = config.get('merge_clauses') -%}\n {%- set clause_types = ['when_matched', 'when_not_matched'] -%}\n\n {%- set has_when_matched = 'when_matched' in merge_clauses -%}\n {%- set has_when_not_matched = 'when_not_matched' in merge_clauses -%}\n\n {%- if not has_when_matched and not has_when_not_matched -%}\n {%- do errors.append(\"merge_clauses must contain at least one of 'when_matched' or 'when_not_matched' keys\") -%}\n {%- endif -%}\n\n {%- for clause_type in clause_types -%}\n {%- if clause_type in merge_clauses -%}\n {%- do validate_merge_clause_list(merge_clauses, clause_type, errors) -%}\n {%- endif -%}\n {%- endfor -%}\n\n {%- set conflicting_configs = [] -%}\n {%- for config_name, config_type in base_configuration_fields.items() -%}\n {%- if config_name not in ['merge_on_using_columns', 'merge_returning_columns'] -%}\n {%- set config_value = config.get(config_name) -%}\n {%- if config_value is not none -%}\n {%- if config_type == 'sequence' -%}\n {%- if config_value|length > 0 -%}\n {%- do conflicting_configs.append(config_name) -%}\n {%- endif -%}\n {%- elif config_type == 'mapping' -%}\n {%- if config_value.keys()|length > 0 -%}\n {%- do conflicting_configs.append(config_name) -%}\n {%- endif -%}\n {%- else -%}\n {%- do conflicting_configs.append(config_name) -%}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n\n {%- if conflicting_configs|length > 0 -%}\n {%- do errors.append(\"When merge_clauses is specified, the following basic merge configurations will be ignored and should be removed: \" ~ conflicting_configs|join(', ') ~ \". Define your merge behavior within merge_clauses instead.\") -%}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.validate_merge_clause_list" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_merge_config": { + "name": "validate_merge_config", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "original_file_path": "macros/materializations/incremental_strategy/merge_config_validation.sql", + "unique_id": "macro.dbt_duckdb.validate_merge_config", + "macro_sql": "{% macro validate_merge_config(config, target_relation=none) %}\n {%- set errors = [] -%}\n\n {%- set base_configuration_fields = {\n 'merge_update_condition': 'string',\n 'merge_insert_condition': 'string',\n 'merge_on_using_columns': 'sequence',\n 'merge_update_columns': 'sequence',\n 'merge_update_set_expressions': 'mapping',\n 'merge_exclude_columns': 'sequence',\n 'merge_returning_columns': 'sequence'\n } -%}\n\n {%- for field_name, field_type in base_configuration_fields.items() -%}\n {%- set field_value = config.get(field_name) -%}\n {%- if field_type == 'string' -%}\n {%- do validate_string_field(field_value, field_name, errors) -%}\n {%- elif field_type == 'sequence' -%}\n {%- do validate_string_list_field(field_value, field_name, errors) -%}\n {%- elif field_type == 'mapping' -%}\n {%- do validate_dict_field(field_value, field_name, errors) -%}\n {%- endif -%}\n {%- endfor -%}\n\n {%- do validate_ducklake_restrictions(config, target_relation, errors) -%}\n\n {%- do validate_merge_clauses(config, base_configuration_fields, errors) -%}\n\n {%- if errors -%}\n {{ exceptions.raise_compiler_error(\"MERGE configuration errors:\\n\" ~ errors|join('\\n')) }}\n {%- endif -%}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.validate_dict_field", + "macro.dbt_duckdb.validate_ducklake_restrictions", + "macro.dbt_duckdb.validate_merge_clauses", + "macro.dbt_duckdb.validate_string_field", + "macro.dbt_duckdb.validate_string_list_field" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_string_field": { + "name": "validate_string_field", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/validation_helper.sql", + "original_file_path": "macros/materializations/incremental_strategy/validation_helper.sql", + "unique_id": "macro.dbt_duckdb.validate_string_field", + "macro_sql": "{%- macro validate_string_field(field_value, field_name, errors) -%}\n {%- if field_value is not none and field_value is not string -%}\n {%- do errors.append(field_name ~ \" must be a string, found: \" ~ field_value) -%}\n {%- endif -%}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.validate_string_list_field": { + "name": "validate_string_list_field", + "package_name": "dbt_duckdb", + "path": "macros/materializations/incremental_strategy/validation_helper.sql", + "original_file_path": "macros/materializations/incremental_strategy/validation_helper.sql", + "unique_id": "macro.dbt_duckdb.validate_string_list_field", + "macro_sql": "{%- macro validate_string_list_field(field_value, field_name, errors) -%}\n {%- if field_value is not none -%}\n {%- if field_value is not sequence or field_value is mapping or field_value is string -%}\n {%- do errors.append(field_name ~ \" must be a list\") -%}\n {%- else -%}\n {%- for item in field_value -%}\n {%- if item is not string -%}\n {%- do errors.append(field_name ~ \" must contain only string values, found: \" ~ item) -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- endif -%}\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_duckdb.write_to_file": { + "name": "write_to_file", + "package_name": "dbt_duckdb", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "unique_id": "macro.dbt_duckdb.write_to_file", + "macro_sql": "{% macro write_to_file(relation, location, options) -%}\n {% call statement('write_to_file') -%}\n copy {{ relation }} to '{{ location }}' ({{ options }})\n {%- endcall %}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils._bigquery__get_matching_schemata": { + "name": "_bigquery__get_matching_schemata", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_pattern_sql.sql", + "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", + "unique_id": "macro.dbt_utils._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 %}", + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils._is_ephemeral": { + "name": "_is_ephemeral", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/_is_ephemeral.sql", + "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", + "unique_id": "macro.dbt_utils._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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils._is_relation": { + "name": "_is_relation", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/_is_relation.sql", + "original_file_path": "macros/jinja_helpers/_is_relation.sql", + "unique_id": "macro.dbt_utils._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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.bigquery__deduplicate": { + "name": "bigquery__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.bigquery__deduplicate", + "macro_sql": "{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": { + "name": "bigquery__get_tables_by_pattern_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_pattern_sql.sql", + "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", + "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", + "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils._bigquery__get_matching_schemata", + "macro.dbt_utils.get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.bigquery__haversine_distance": { + "name": "bigquery__haversine_distance", + "package_name": "dbt_utils", + "path": "macros/sql/haversine_distance.sql", + "original_file_path": "macros/sql/haversine_distance.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.degrees_to_radians" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.databricks__deduplicate": { + "name": "databricks__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.databricks__deduplicate", + "macro_sql": "{%- macro databricks__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.databricks__get_table_types_sql": { + "name": "databricks__get_table_types_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_table_types_sql.sql", + "original_file_path": "macros/sql/get_table_types_sql.sql", + "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", + "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.date_spine": { + "name": "date_spine", + "package_name": "dbt_utils", + "path": "macros/sql/date_spine.sql", + "original_file_path": "macros/sql/date_spine.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__date_spine" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.deduplicate": { + "name": "deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.deduplicate", + "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__deduplicate" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__date_spine": { + "name": "default__date_spine", + "package_name": "dbt_utils", + "path": "macros/sql/date_spine.sql", + "original_file_path": "macros/sql/date_spine.sql", + "unique_id": "macro.dbt_utils.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 \"dbt.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.dateadd(\n datepart,\n \"row_number() over (order by generated_number) - 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 %}", + "depends_on": { + "macros": [ + "macro.dbt.dateadd", + "macro.dbt_utils.generate_series", + "macro.dbt_utils.get_intervals_between" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__deduplicate": { + "name": "default__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.default__deduplicate", + "macro_sql": "{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__generate_series": { + "name": "default__generate_series", + "package_name": "dbt_utils", + "path": "macros/sql/generate_series.sql", + "original_file_path": "macros/sql/generate_series.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_powers_of_two" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__generate_surrogate_key": { + "name": "default__generate_surrogate_key", + "package_name": "dbt_utils", + "path": "macros/sql/generate_surrogate_key.sql", + "original_file_path": "macros/sql/generate_surrogate_key.sql", + "unique_id": "macro.dbt_utils.default__generate_surrogate_key", + "macro_sql": "{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n {%- set default_null_value = \"\" -%}\n{%- else -%}\n {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n {%- do fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value ~\"')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- do fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.concat", + "macro.dbt.hash", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_column_values": { + "name": "default__get_column_values", + "package_name": "dbt_utils", + "path": "macros/sql/get_column_values.sql", + "original_file_path": "macros/sql/get_column_values.sql", + "unique_id": "macro.dbt_utils.default__get_column_values", + "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt_utils._is_ephemeral" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_filtered_columns_in_relation": { + "name": "default__get_filtered_columns_in_relation", + "package_name": "dbt_utils", + "path": "macros/sql/get_filtered_columns_in_relation.sql", + "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", + "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", + "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return([]) }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_intervals_between": { + "name": "default__get_intervals_between", + "package_name": "dbt_utils", + "path": "macros/sql/date_spine.sql", + "original_file_path": "macros/sql/date_spine.sql", + "unique_id": "macro.dbt_utils.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.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.datediff", + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_powers_of_two": { + "name": "default__get_powers_of_two", + "package_name": "dbt_utils", + "path": "macros/sql/generate_series.sql", + "original_file_path": "macros/sql/generate_series.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_query_results_as_dict": { + "name": "default__get_query_results_as_dict", + "package_name": "dbt_utils", + "path": "macros/sql/get_query_results_as_dict.sql", + "original_file_path": "macros/sql/get_query_results_as_dict.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_relations_by_pattern": { + "name": "default__get_relations_by_pattern", + "package_name": "dbt_utils", + "path": "macros/sql/get_relations_by_pattern.sql", + "original_file_path": "macros/sql/get_relations_by_pattern.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt_utils.get_tables_by_pattern_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_relations_by_prefix": { + "name": "default__get_relations_by_prefix", + "package_name": "dbt_utils", + "path": "macros/sql/get_relations_by_prefix.sql", + "original_file_path": "macros/sql/get_relations_by_prefix.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt_utils.get_tables_by_prefix_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_single_value": { + "name": "default__get_single_value", + "package_name": "dbt_utils", + "path": "macros/sql/get_single_value.sql", + "original_file_path": "macros/sql/get_single_value.sql", + "unique_id": "macro.dbt_utils.default__get_single_value", + "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {%- if execute -%}\n\n {% set r = load_result('get_query_result').table.columns[0].values() %}\n {% if r | length == 0 %}\n {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n {% set sql_result = default %}\n {% else %}\n {% set sql_result = r[0] %}\n {% endif %}\n \n {%- else -%}\n \n {% set sql_result = default %}\n \n {%- endif -%}\n\n {% do return(sql_result) %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_table_types_sql": { + "name": "default__get_table_types_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_table_types_sql.sql", + "original_file_path": "macros/sql/get_table_types_sql.sql", + "unique_id": "macro.dbt_utils.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 {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_tables_by_pattern_sql": { + "name": "default__get_tables_by_pattern_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_pattern_sql.sql", + "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", + "unique_id": "macro.dbt_utils.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 {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_tables_by_prefix_sql": { + "name": "default__get_tables_by_prefix_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_prefix_sql.sql", + "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_tables_by_pattern_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_url_host": { + "name": "default__get_url_host", + "package_name": "dbt_utils", + "path": "macros/web/get_url_host.sql", + "original_file_path": "macros/web/get_url_host.sql", + "unique_id": "macro.dbt_utils.default__get_url_host", + "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt.split_part(\n dbt.split_part(\n dbt.replace(\n dbt.replace(\n dbt.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt.safe_cast(\n parsed,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.replace", + "macro.dbt.safe_cast", + "macro.dbt.split_part", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_url_parameter": { + "name": "default__get_url_parameter", + "package_name": "dbt_utils", + "path": "macros/web/get_url_parameter.sql", + "original_file_path": "macros/web/get_url_parameter.sql", + "unique_id": "macro.dbt_utils.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.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.split_part" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__get_url_path": { + "name": "default__get_url_path", + "package_name": "dbt_utils", + "path": "macros/web/get_url_path.sql", + "original_file_path": "macros/web/get_url_path.sql", + "unique_id": "macro.dbt_utils.default__get_url_path", + "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url =\n dbt.replace(\n dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n {{ dbt.position(\"'?'\", stripped_url) }} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt.split_part(\n dbt.right(\n stripped_url,\n dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ),\n \"'?'\", 1\n )\n -%}\n\n {{ dbt.safe_cast(\n parsed_path,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.length", + "macro.dbt.position", + "macro.dbt.replace", + "macro.dbt.right", + "macro.dbt.safe_cast", + "macro.dbt.split_part", + "macro.dbt.type_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__group_by": { + "name": "default__group_by", + "package_name": "dbt_utils", + "path": "macros/sql/groupby.sql", + "original_file_path": "macros/sql/groupby.sql", + "unique_id": "macro.dbt_utils.default__group_by", + "macro_sql": "{%- 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 -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__haversine_distance": { + "name": "default__haversine_distance", + "package_name": "dbt_utils", + "path": "macros/sql/haversine_distance.sql", + "original_file_path": "macros/sql/haversine_distance.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__log_info": { + "name": "default__log_info", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/log_info.sql", + "original_file_path": "macros/jinja_helpers/log_info.sql", + "unique_id": "macro.dbt_utils.default__log_info", + "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.pretty_log_format" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__nullcheck": { + "name": "default__nullcheck", + "package_name": "dbt_utils", + "path": "macros/sql/nullcheck.sql", + "original_file_path": "macros/sql/nullcheck.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__nullcheck_table": { + "name": "default__nullcheck_table", + "package_name": "dbt_utils", + "path": "macros/sql/nullcheck_table.sql", + "original_file_path": "macros/sql/nullcheck_table.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation", + "macro.dbt_utils.nullcheck" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__pivot": { + "name": "default__pivot", + "package_name": "dbt_utils", + "path": "macros/sql/pivot.sql", + "original_file_path": "macros/sql/pivot.sql", + "unique_id": "macro.dbt_utils.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.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.escape_single_quotes", + "macro.dbt_utils.slugify" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__pretty_log_format": { + "name": "default__pretty_log_format", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/pretty_log_format.sql", + "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", + "unique_id": "macro.dbt_utils.default__pretty_log_format", + "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.pretty_time" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__pretty_time": { + "name": "default__pretty_time", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/pretty_time.sql", + "original_file_path": "macros/jinja_helpers/pretty_time.sql", + "unique_id": "macro.dbt_utils.default__pretty_time", + "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__safe_add": { + "name": "default__safe_add", + "package_name": "dbt_utils", + "path": "macros/sql/safe_add.sql", + "original_file_path": "macros/sql/safe_add.sql", + "unique_id": "macro.dbt_utils.default__safe_add", + "macro_sql": "{%- macro default__safe_add(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_add` macro now takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__safe_divide": { + "name": "default__safe_divide", + "package_name": "dbt_utils", + "path": "macros/sql/safe_divide.sql", + "original_file_path": "macros/sql/safe_divide.sql", + "unique_id": "macro.dbt_utils.default__safe_divide", + "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__safe_subtract": { + "name": "default__safe_subtract", + "package_name": "dbt_utils", + "path": "macros/sql/safe_subtract.sql", + "original_file_path": "macros/sql/safe_subtract.sql", + "unique_id": "macro.dbt_utils.default__safe_subtract", + "macro_sql": "{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n ') }}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__star": { + "name": "default__star", + "package_name": "dbt_utils", + "path": "macros/sql/star.sql", + "original_file_path": "macros/sql/star.sql", + "unique_id": "macro.dbt_utils.default__star", + "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True, unquote_aliases=False, rename={}) -%}\r\n {%- do dbt_utils._is_relation(from, 'star') -%}\r\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n {%- if not execute -%}\r\n {% do return('*') %}\r\n {%- endif -%}\r\n\r\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n {%- set rename_lower = {} -%}\r\n {%- for key, val in rename.items() -%}\r\n {%- do rename_lower.update({key.lower(): val}) -%}\r\n {%- endfor -%}\r\n\r\n {%- if cols|length <= 0 -%}\r\n {% if flags.WHICH == 'compile' %}\r\n {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet\r\nor all columns were excluded. This star is only output during\r\ndbt compile, and exists to keep SQLFluff happy. */\r\n {% endset %}\r\n {% do return(response) %}\r\n {% else %}\r\n {% do return(\"/* no columns returned from star() macro */\") %}\r\n {% endif %}\r\n {%- else -%}\r\n {%- for col in cols %}\r\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n {%- if quote_identifiers -%}\r\n {{ adapter.quote(col)|trim }}\r\n {%- if col.lower() in rename_lower %} as {{ rename_lower[col.lower()] }}\r\n {%- elif unquote_aliases %} as {{ (prefix ~ col ~ suffix)|trim }}\r\n {%- elif prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }}\r\n {%- endif -%}\r\n {%- else -%}\r\n {{ col|trim }}\r\n {%- if col.lower() in rename_lower %} as {{ rename_lower[col.lower()] }}\r\n {%- elif prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }}\r\n {%- endif -%}\r\n {%- endif -%}\r\n {%- if not loop.last %},{{ '\\n ' }}{%- endif -%}\r\n {%- endfor -%}\r\n {% endif %}\r\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation", + "macro.dbt_utils.get_filtered_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__surrogate_key": { + "name": "default__surrogate_key", + "package_name": "dbt_utils", + "path": "macros/sql/surrogate_key.sql", + "original_file_path": "macros/sql/surrogate_key.sql", + "unique_id": "macro.dbt_utils.default__surrogate_key", + "macro_sql": "{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_accepted_range": { + "name": "default__test_accepted_range", + "package_name": "dbt_utils", + "path": "macros/generic_tests/accepted_range.sql", + "original_file_path": "macros/generic_tests/accepted_range.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_at_least_one": { + "name": "default__test_at_least_one", + "package_name": "dbt_utils", + "path": "macros/generic_tests/at_least_one.sql", + "original_file_path": "macros/generic_tests/at_least_one.sql", + "unique_id": "macro.dbt_utils.default__test_at_least_one", + "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n {% set pruned_cols = group_by_columns %}\n\n {% if column_name not in pruned_cols %}\n {% do pruned_cols.append(column_name) %}\n {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n with pruned_rows as (\n select\n {{ select_pruned_cols }}\n from {{ model }}\n {% if group_by_columns|length() == 0 %}\n where {{ column_name }} is not null\n limit 1\n {% endif %}\n )\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count({{ column_name }}) as filler_column\n\n from pruned_rows\n\n {{groupby_gb_cols}}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_cardinality_equality": { + "name": "default__test_cardinality_equality", + "package_name": "dbt_utils", + "path": "macros/generic_tests/cardinality_equality.sql", + "original_file_path": "macros/generic_tests/cardinality_equality.sql", + "unique_id": "macro.dbt_utils.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.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.except" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_equal_rowcount": { + "name": "default__test_equal_rowcount", + "package_name": "dbt_utils", + "path": "macros/generic_tests/equal_rowcount.sql", + "original_file_path": "macros/generic_tests/equal_rowcount.sql", + "unique_id": "macro.dbt_utils.default__test_equal_rowcount", + "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(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\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_a \n from {{ model }}\n {{groupby_gb_cols}}\n\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_b \n from {{ compare_model }}\n {{groupby_gb_cols}}\n\n),\nfinal as (\n\n select\n \n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n\n from a\n full join b\n on\n a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_equality": { + "name": "default__test_equality", + "package_name": "dbt_utils", + "path": "macros/generic_tests/equality.sql", + "original_file_path": "macros/generic_tests/equality.sql", + "unique_id": "macro.dbt_utils.default__test_equality", + "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n\n{%- if compare_columns and exclude_columns -%}\n {{ exceptions.raise_compiler_error(\"Both a compare and an ignore list were provided to the `equality` macro. Only one is allowed\") }}\n{%- endif -%}\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\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{# Ensure there are no extra columns in the compare_model vs model #}\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- do dbt_utils._is_ephemeral(compare_model, 'test_equality') -%}\n\n {%- set model_columns = adapter.get_columns_in_relation(model) -%}\n {%- set compare_model_columns = adapter.get_columns_in_relation(compare_model) -%}\n\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- set include_model_columns = [] %}\n {%- for column in model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n {%- for column in compare_model_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_model_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns_set = set(include_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(include_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- else -%}\n {%- set compare_columns_set = set(model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- set compare_model_columns_set = set(compare_model_columns | map(attribute='quoted') | map(\"lower\")) %}\n {%- endif -%}\n\n {% if compare_columns_set != compare_model_columns_set %}\n {{ exceptions.raise_compiler_error(compare_model ~\" has less columns than \" ~ model ~ \", please ensure they have the same columns or use the `compare_columns` or `exclude_columns` arguments to subset them.\") }}\n {% endif %}\n\n\n{% endif %}\n\n{%- if not precision -%}\n {%- if not compare_columns -%}\n {# \n You cannot get the columns in an ephemeral model (due to not existing in the information schema),\n so if the user does not provide an explicit list of columns we must error in the case it is ephemeral\n #}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model)-%}\n\n {%- if exclude_columns -%}\n {#-- Lower case ignore columns for easier comparison --#}\n {%- set exclude_columns = exclude_columns | map(\"lower\") | list %}\n\n {# Filter out the excluded columns #}\n {%- set include_columns = [] %}\n {%- for column in compare_columns -%}\n {%- if column.name | lower not in exclude_columns -%}\n {% do include_columns.append(column) %}\n {%- endif %}\n {%- endfor %}\n\n {%- set compare_columns = include_columns | map(attribute='quoted') %}\n {%- else -%} {# Compare columns provided #}\n {%- set compare_columns = compare_columns | map(attribute='quoted') %}\n {%- endif -%}\n {%- endif -%}\n\n {% set compare_cols_csv = compare_columns | join(', ') %}\n\n{% else %} {# Precision required #}\n {#-\n If rounding is required, we need to get the types, so it cannot be ephemeral even if they provide column names\n -#}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set columns = adapter.get_columns_in_relation(model) -%}\n\n {% set columns_list = [] %}\n {%- for col in columns -%}\n {%- if (\n (col.name|lower in compare_columns|map('lower') or not compare_columns) and\n (col.name|lower not in exclude_columns|map('lower') or not exclude_columns)\n ) -%}\n {# Databricks double type is not picked up by any number type checks in dbt #}\n {%- if col.is_float() or col.is_numeric() or col.data_type == 'double' -%}\n {# Cast is required due to postgres not having round for a double precision number #}\n {%- do columns_list.append('round(cast(' ~ col.quoted ~ ' as ' ~ dbt.type_numeric() ~ '),' ~ precision ~ ') as ' ~ col.quoted) -%}\n {%- else -%} {# Non-numeric type #}\n {%- do columns_list.append(col.quoted) -%}\n {%- endif -%}\n {% endif %}\n {%- endfor -%}\n\n {% set compare_cols_csv = columns_list | join(', ') %}\n\n{% endif %}\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.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.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.except", + "macro.dbt.type_numeric", + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_expression_is_true": { + "name": "default__test_expression_is_true", + "package_name": "dbt_utils", + "path": "macros/generic_tests/expression_is_true.sql", + "original_file_path": "macros/generic_tests/expression_is_true.sql", + "unique_id": "macro.dbt_utils.default__test_expression_is_true", + "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.should_store_failures" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_fewer_rows_than": { + "name": "default__test_fewer_rows_than", + "package_name": "dbt_utils", + "path": "macros/generic_tests/fewer_rows_than.sql", + "original_file_path": "macros/generic_tests/fewer_rows_than.sql", + "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", + "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_our_model \n from {{ model }}\n {{ groupby_gb_cols }}\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_comparison_model \n from {{ compare_model }}\n {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n select\n\n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_our_model,\n count_comparison_model\n from a\n full join b on \n a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n {{ join_gb_cols }}\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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_mutually_exclusive_ranges": { + "name": "default__test_mutually_exclusive_ranges", + "package_name": "dbt_utils", + "path": "macros/generic_tests/mutually_exclusive_ranges.sql", + "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", + "unique_id": "macro.dbt_utils.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 }}, {{ upper_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc, {{ upper_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 more 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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_not_accepted_values": { + "name": "default__test_not_accepted_values", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_accepted_values.sql", + "original_file_path": "macros/generic_tests/not_accepted_values.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_not_constant": { + "name": "default__test_not_constant", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_constant.sql", + "original_file_path": "macros/generic_tests/not_constant.sql", + "unique_id": "macro.dbt_utils.default__test_not_constant", + "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_not_empty_string": { + "name": "default__test_not_empty_string", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_empty_string.sql", + "original_file_path": "macros/generic_tests/not_empty_string.sql", + "unique_id": "macro.dbt_utils.default__test_not_empty_string", + "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n with\n \n all_values as (\n\n select \n\n\n {% if trim_whitespace == true -%}\n\n trim({{ column_name }}) as {{ column_name }}\n\n {%- else -%}\n\n {{ column_name }}\n\n {%- endif %}\n \n from {{ model }}\n\n ),\n\n errors as (\n\n select * from all_values\n where {{ column_name }} = ''\n\n )\n\n select * from errors\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_not_null_proportion": { + "name": "default__test_not_null_proportion", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_null_proportion.sql", + "original_file_path": "macros/generic_tests/not_null_proportion.sql", + "unique_id": "macro.dbt_utils.default__test_not_null_proportion", + "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\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\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n select\n {{select_gb_cols}}\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as {{ dbt.type_numeric() }}) as not_null_proportion\n from {{ model }}\n {{groupby_gb_cols}}\n),\nvalidation_errors as (\n select\n {{select_gb_cols}}\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 %}", + "depends_on": { + "macros": [ + "macro.dbt.type_numeric" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_recency": { + "name": "default__test_recency", + "package_name": "dbt_utils", + "path": "macros/generic_tests/recency.sql", + "original_file_path": "macros/generic_tests/recency.sql", + "unique_id": "macro.dbt_utils.default__test_recency", + "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set empty_invocation = flags.EMPTY is defined and flags.EMPTY %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')' %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n select \n\n {{ select_gb_cols }}\n {% if ignore_time_component %}\n cast(max({{ field }}) as date) as most_recent\n {%- else %}\n max({{ field }}) as most_recent\n {%- endif %}\n\n from {{ model }}\n\n {{ groupby_gb_cols }}\n\n)\n\nselect\n\n {{ select_gb_cols }}\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n{%- if not empty_invocation %}\n or most_recent is null\n{%- endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp", + "macro.dbt.dateadd", + "macro.dbt.type_timestamp" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_relationships_where": { + "name": "default__test_relationships_where", + "package_name": "dbt_utils", + "path": "macros/generic_tests/relationships_where.sql", + "original_file_path": "macros/generic_tests/relationships_where.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_sequential_values": { + "name": "default__test_sequential_values", + "package_name": "dbt_utils", + "path": "macros/generic_tests/sequential_values.sql", + "original_file_path": "macros/generic_tests/sequential_values.sql", + "unique_id": "macro.dbt_utils.default__test_sequential_values", + "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n select\n {{ select_gb_cols }}\n {{ column_name }},\n lag({{ column_name }}) over (\n {{partition_gb_cols}}\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.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.dateadd", + "macro.dbt.type_timestamp", + "macro.dbt_utils.slugify" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__test_unique_combination_of_columns": { + "name": "default__test_unique_combination_of_columns", + "package_name": "dbt_utils", + "path": "macros/generic_tests/unique_combination_of_columns.sql", + "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", + "unique_id": "macro.dbt_utils.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 {% do 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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__union_relations": { + "name": "default__union_relations", + "package_name": "dbt_utils", + "path": "macros/sql/union.sql", + "original_file_path": "macros/sql/union.sql", + "unique_id": "macro.dbt_utils.default__union_relations", + "macro_sql": "{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n {%- set all_excludes = [] -%}\n {%- set all_includes = [] -%}\n\n {%- if exclude -%}\n {%- for exc in exclude -%}\n {%- do all_excludes.append(exc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if include -%}\n {%- for inc in include -%}\n {%- do all_includes.append(inc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\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 | lower in all_excludes -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column | lower not in all_includes -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n {%- if source_column_name is not none %}\n cast({{ dbt.string_literal(relation.render()) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n {%- endif %}\n\n /* No columns from any of the relations.\n This star is only output during dbt compile, and exists to keep SQLFluff happy. */\n {% if dbt_command == 'compile' and ordered_column_names|length == 0 %}\n *\n {% endif %}\n\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", + "depends_on": { + "macros": [ + "macro.dbt.string_literal", + "macro.dbt.type_string", + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__unpivot": { + "name": "default__unpivot", + "package_name": "dbt_utils", + "path": "macros/sql/unpivot.sql", + "original_file_path": "macros/sql/unpivot.sql", + "unique_id": "macro.dbt_utils.default__unpivot", + "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n\n {% if not relation %}\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 {%- set current_col_name = adapter.quote(col.column) if quote_identifiers else col.column -%}\n select\n {%- for exclude_col in exclude %}\n {{ adapter.quote(exclude_col) if quote_identifiers else exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt.type_string() }}) as {{ adapter.quote(field_name) if quote_identifiers else field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.cast_bool_to_text(current_col_name) }}\n {% else %}\n {{ current_col_name }}\n {% endif %}\n as {{ cast_to }}) as {{ adapter.quote(value_name) if quote_identifiers else value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt.cast_bool_to_text", + "macro.dbt.type_string", + "macro.dbt_utils._is_ephemeral", + "macro.dbt_utils._is_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.default__width_bucket": { + "name": "default__width_bucket", + "package_name": "dbt_utils", + "path": "macros/sql/width_bucket.sql", + "original_file_path": "macros/sql/width_bucket.sql", + "unique_id": "macro.dbt_utils.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.safe_cast(expr, dbt.type_numeric() ) }},\n {{ dbt.safe_cast(bin_size, dbt.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 %}", + "depends_on": { + "macros": [ + "macro.dbt.safe_cast", + "macro.dbt.type_numeric" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.degrees_to_radians": { + "name": "degrees_to_radians", + "package_name": "dbt_utils", + "path": "macros/sql/haversine_distance.sql", + "original_file_path": "macros/sql/haversine_distance.sql", + "unique_id": "macro.dbt_utils.degrees_to_radians", + "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.generate_series": { + "name": "generate_series", + "package_name": "dbt_utils", + "path": "macros/sql/generate_series.sql", + "original_file_path": "macros/sql/generate_series.sql", + "unique_id": "macro.dbt_utils.generate_series", + "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_duckdb.duckdb__generate_series" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.generate_surrogate_key": { + "name": "generate_surrogate_key", + "package_name": "dbt_utils", + "path": "macros/sql/generate_surrogate_key.sql", + "original_file_path": "macros/sql/generate_surrogate_key.sql", + "unique_id": "macro.dbt_utils.generate_surrogate_key", + "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__generate_surrogate_key" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_column_values": { + "name": "get_column_values", + "package_name": "dbt_utils", + "path": "macros/sql/get_column_values.sql", + "original_file_path": "macros/sql/get_column_values.sql", + "unique_id": "macro.dbt_utils.get_column_values", + "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_column_values" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_filtered_columns_in_relation": { + "name": "get_filtered_columns_in_relation", + "package_name": "dbt_utils", + "path": "macros/sql/get_filtered_columns_in_relation.sql", + "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", + "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", + "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_filtered_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_intervals_between": { + "name": "get_intervals_between", + "package_name": "dbt_utils", + "path": "macros/sql/date_spine.sql", + "original_file_path": "macros/sql/date_spine.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_intervals_between" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_powers_of_two": { + "name": "get_powers_of_two", + "package_name": "dbt_utils", + "path": "macros/sql/generate_series.sql", + "original_file_path": "macros/sql/generate_series.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_powers_of_two" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_query_results_as_dict": { + "name": "get_query_results_as_dict", + "package_name": "dbt_utils", + "path": "macros/sql/get_query_results_as_dict.sql", + "original_file_path": "macros/sql/get_query_results_as_dict.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_query_results_as_dict" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_relations_by_pattern": { + "name": "get_relations_by_pattern", + "package_name": "dbt_utils", + "path": "macros/sql/get_relations_by_pattern.sql", + "original_file_path": "macros/sql/get_relations_by_pattern.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_relations_by_pattern" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_relations_by_prefix": { + "name": "get_relations_by_prefix", + "package_name": "dbt_utils", + "path": "macros/sql/get_relations_by_prefix.sql", + "original_file_path": "macros/sql/get_relations_by_prefix.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_relations_by_prefix" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_single_value": { + "name": "get_single_value", + "package_name": "dbt_utils", + "path": "macros/sql/get_single_value.sql", + "original_file_path": "macros/sql/get_single_value.sql", + "unique_id": "macro.dbt_utils.get_single_value", + "macro_sql": "{% macro get_single_value(query, default=none) %}\n {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_single_value" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_table_types_sql": { + "name": "get_table_types_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_table_types_sql.sql", + "original_file_path": "macros/sql/get_table_types_sql.sql", + "unique_id": "macro.dbt_utils.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", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_tables_by_pattern_sql": { + "name": "get_tables_by_pattern_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_pattern_sql.sql", + "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_tables_by_pattern_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_tables_by_prefix_sql": { + "name": "get_tables_by_prefix_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_prefix_sql.sql", + "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_tables_by_prefix_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_url_host": { + "name": "get_url_host", + "package_name": "dbt_utils", + "path": "macros/web/get_url_host.sql", + "original_file_path": "macros/web/get_url_host.sql", + "unique_id": "macro.dbt_utils.get_url_host", + "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_url_host" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_url_parameter": { + "name": "get_url_parameter", + "package_name": "dbt_utils", + "path": "macros/web/get_url_parameter.sql", + "original_file_path": "macros/web/get_url_parameter.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_url_parameter" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.get_url_path": { + "name": "get_url_path", + "package_name": "dbt_utils", + "path": "macros/web/get_url_path.sql", + "original_file_path": "macros/web/get_url_path.sql", + "unique_id": "macro.dbt_utils.get_url_path", + "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__get_url_path" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.group_by": { + "name": "group_by", + "package_name": "dbt_utils", + "path": "macros/sql/groupby.sql", + "original_file_path": "macros/sql/groupby.sql", + "unique_id": "macro.dbt_utils.group_by", + "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__group_by" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.haversine_distance": { + "name": "haversine_distance", + "package_name": "dbt_utils", + "path": "macros/sql/haversine_distance.sql", + "original_file_path": "macros/sql/haversine_distance.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__haversine_distance" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.log_info": { + "name": "log_info", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/log_info.sql", + "original_file_path": "macros/jinja_helpers/log_info.sql", + "unique_id": "macro.dbt_utils.log_info", + "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__log_info" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.nullcheck": { + "name": "nullcheck", + "package_name": "dbt_utils", + "path": "macros/sql/nullcheck.sql", + "original_file_path": "macros/sql/nullcheck.sql", + "unique_id": "macro.dbt_utils.nullcheck", + "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__nullcheck" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.nullcheck_table": { + "name": "nullcheck_table", + "package_name": "dbt_utils", + "path": "macros/sql/nullcheck_table.sql", + "original_file_path": "macros/sql/nullcheck_table.sql", + "unique_id": "macro.dbt_utils.nullcheck_table", + "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__nullcheck_table" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.pivot": { + "name": "pivot", + "package_name": "dbt_utils", + "path": "macros/sql/pivot.sql", + "original_file_path": "macros/sql/pivot.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__pivot" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.postgres__deduplicate": { + "name": "postgres__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.postgres__deduplicate", + "macro_sql": "{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.postgres__get_table_types_sql": { + "name": "postgres__get_table_types_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_table_types_sql.sql", + "original_file_path": "macros/sql/get_table_types_sql.sql", + "unique_id": "macro.dbt_utils.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 {{ adapter.quote('table_type') }}\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.pretty_log_format": { + "name": "pretty_log_format", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/pretty_log_format.sql", + "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", + "unique_id": "macro.dbt_utils.pretty_log_format", + "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__pretty_log_format" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.pretty_time": { + "name": "pretty_time", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/pretty_time.sql", + "original_file_path": "macros/jinja_helpers/pretty_time.sql", + "unique_id": "macro.dbt_utils.pretty_time", + "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__pretty_time" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.redshift__deduplicate": { + "name": "redshift__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.redshift__deduplicate", + "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }} as tt\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.redshift__get_tables_by_pattern_sql": { + "name": "redshift__get_tables_by_pattern_sql", + "package_name": "dbt_utils", + "path": "macros/sql/get_tables_by_pattern_sql.sql", + "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", + "unique_id": "macro.dbt_utils.redshift__get_tables_by_pattern_sql", + "macro_sql": "{% macro redshift__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% set sql %}\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('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 union all\n select distinct\n schemaname as {{ adapter.quote('table_schema') }},\n tablename as {{ adapter.quote('table_name') }},\n 'external' as {{ adapter.quote('table_type') }}\n from svv_external_tables\n where redshift_database_name = '{{ database }}'\n and schemaname ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n {% endset %}\n\n {{ return(sql) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.get_table_types_sql" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.safe_add": { + "name": "safe_add", + "package_name": "dbt_utils", + "path": "macros/sql/safe_add.sql", + "original_file_path": "macros/sql/safe_add.sql", + "unique_id": "macro.dbt_utils.safe_add", + "macro_sql": "{%- macro safe_add(field_list) -%}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__safe_add" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.safe_divide": { + "name": "safe_divide", + "package_name": "dbt_utils", + "path": "macros/sql/safe_divide.sql", + "original_file_path": "macros/sql/safe_divide.sql", + "unique_id": "macro.dbt_utils.safe_divide", + "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__safe_divide" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.safe_subtract": { + "name": "safe_subtract", + "package_name": "dbt_utils", + "path": "macros/sql/safe_subtract.sql", + "original_file_path": "macros/sql/safe_subtract.sql", + "unique_id": "macro.dbt_utils.safe_subtract", + "macro_sql": "{%- macro safe_subtract(field_list) -%}\n {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__safe_subtract" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.slugify": { + "name": "slugify", + "package_name": "dbt_utils", + "path": "macros/jinja_helpers/slugify.sql", + "original_file_path": "macros/jinja_helpers/slugify.sql", + "unique_id": "macro.dbt_utils.slugify", + "macro_sql": "{% macro slugify(string) %}\n\n{% if not string %}\n{{ return('') }}\n{% endif %}\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{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.snowflake__deduplicate": { + "name": "snowflake__deduplicate", + "package_name": "dbt_utils", + "path": "macros/sql/deduplicate.sql", + "original_file_path": "macros/sql/deduplicate.sql", + "unique_id": "macro.dbt_utils.snowflake__deduplicate", + "macro_sql": "{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.snowflake__width_bucket": { + "name": "snowflake__width_bucket", + "package_name": "dbt_utils", + "path": "macros/sql/width_bucket.sql", + "original_file_path": "macros/sql/width_bucket.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.star": { + "name": "star", + "package_name": "dbt_utils", + "path": "macros/sql/star.sql", + "original_file_path": "macros/sql/star.sql", + "unique_id": "macro.dbt_utils.star", + "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True, unquote_aliases=False, rename={}) -%}\r\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers, unquote_aliases, rename)) }}\r\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__star" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.surrogate_key": { + "name": "surrogate_key", + "package_name": "dbt_utils", + "path": "macros/sql/surrogate_key.sql", + "original_file_path": "macros/sql/surrogate_key.sql", + "unique_id": "macro.dbt_utils.surrogate_key", + "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__surrogate_key" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_accepted_range": { + "name": "test_accepted_range", + "package_name": "dbt_utils", + "path": "macros/generic_tests/accepted_range.sql", + "original_file_path": "macros/generic_tests/accepted_range.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_accepted_range" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_at_least_one": { + "name": "test_at_least_one", + "package_name": "dbt_utils", + "path": "macros/generic_tests/at_least_one.sql", + "original_file_path": "macros/generic_tests/at_least_one.sql", + "unique_id": "macro.dbt_utils.test_at_least_one", + "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_at_least_one" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_cardinality_equality": { + "name": "test_cardinality_equality", + "package_name": "dbt_utils", + "path": "macros/generic_tests/cardinality_equality.sql", + "original_file_path": "macros/generic_tests/cardinality_equality.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_cardinality_equality" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_equal_rowcount": { + "name": "test_equal_rowcount", + "package_name": "dbt_utils", + "path": "macros/generic_tests/equal_rowcount.sql", + "original_file_path": "macros/generic_tests/equal_rowcount.sql", + "unique_id": "macro.dbt_utils.test_equal_rowcount", + "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_equal_rowcount" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_equality": { + "name": "test_equality", + "package_name": "dbt_utils", + "path": "macros/generic_tests/equality.sql", + "original_file_path": "macros/generic_tests/equality.sql", + "unique_id": "macro.dbt_utils.test_equality", + "macro_sql": "{% test equality(model, compare_model, compare_columns=None, exclude_columns=None, precision = None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns, exclude_columns, precision)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_equality" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_expression_is_true": { + "name": "test_expression_is_true", + "package_name": "dbt_utils", + "path": "macros/generic_tests/expression_is_true.sql", + "original_file_path": "macros/generic_tests/expression_is_true.sql", + "unique_id": "macro.dbt_utils.test_expression_is_true", + "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_expression_is_true" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_fewer_rows_than": { + "name": "test_fewer_rows_than", + "package_name": "dbt_utils", + "path": "macros/generic_tests/fewer_rows_than.sql", + "original_file_path": "macros/generic_tests/fewer_rows_than.sql", + "unique_id": "macro.dbt_utils.test_fewer_rows_than", + "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_fewer_rows_than" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_mutually_exclusive_ranges": { + "name": "test_mutually_exclusive_ranges", + "package_name": "dbt_utils", + "path": "macros/generic_tests/mutually_exclusive_ranges.sql", + "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_mutually_exclusive_ranges" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_not_accepted_values": { + "name": "test_not_accepted_values", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_accepted_values.sql", + "original_file_path": "macros/generic_tests/not_accepted_values.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_not_accepted_values" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_not_constant": { + "name": "test_not_constant", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_constant.sql", + "original_file_path": "macros/generic_tests/not_constant.sql", + "unique_id": "macro.dbt_utils.test_not_constant", + "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_not_constant" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_not_empty_string": { + "name": "test_not_empty_string", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_empty_string.sql", + "original_file_path": "macros/generic_tests/not_empty_string.sql", + "unique_id": "macro.dbt_utils.test_not_empty_string", + "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_not_empty_string" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_not_null_proportion": { + "name": "test_not_null_proportion", + "package_name": "dbt_utils", + "path": "macros/generic_tests/not_null_proportion.sql", + "original_file_path": "macros/generic_tests/not_null_proportion.sql", + "unique_id": "macro.dbt_utils.test_not_null_proportion", + "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_not_null_proportion" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_recency": { + "name": "test_recency", + "package_name": "dbt_utils", + "path": "macros/generic_tests/recency.sql", + "original_file_path": "macros/generic_tests/recency.sql", + "unique_id": "macro.dbt_utils.test_recency", + "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_recency" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_relationships_where": { + "name": "test_relationships_where", + "package_name": "dbt_utils", + "path": "macros/generic_tests/relationships_where.sql", + "original_file_path": "macros/generic_tests/relationships_where.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_relationships_where" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_sequential_values": { + "name": "test_sequential_values", + "package_name": "dbt_utils", + "path": "macros/generic_tests/sequential_values.sql", + "original_file_path": "macros/generic_tests/sequential_values.sql", + "unique_id": "macro.dbt_utils.test_sequential_values", + "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_sequential_values" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.test_unique_combination_of_columns": { + "name": "test_unique_combination_of_columns", + "package_name": "dbt_utils", + "path": "macros/generic_tests/unique_combination_of_columns.sql", + "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__test_unique_combination_of_columns" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.union_relations": { + "name": "union_relations", + "package_name": "dbt_utils", + "path": "macros/sql/union.sql", + "original_file_path": "macros/sql/union.sql", + "unique_id": "macro.dbt_utils.union_relations", + "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__union_relations" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.unpivot": { + "name": "unpivot", + "package_name": "dbt_utils", + "path": "macros/sql/unpivot.sql", + "original_file_path": "macros/sql/unpivot.sql", + "unique_id": "macro.dbt_utils.unpivot", + "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', quote_identifiers=False) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, quote_identifiers)) }}\n{% endmacro %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__unpivot" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.dbt_utils.width_bucket": { + "name": "width_bucket", + "package_name": "dbt_utils", + "path": "macros/sql/width_bucket.sql", + "original_file_path": "macros/sql/width_bucket.sql", + "unique_id": "macro.dbt_utils.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 %}", + "depends_on": { + "macros": [ + "macro.dbt_utils.default__width_bucket" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.bigquery__cents_to_dollars": { + "name": "bigquery__cents_to_dollars", + "package_name": "jaffle_shop", + "path": "macros/cents_to_dollars.sql", + "original_file_path": "macros/cents_to_dollars.sql", + "unique_id": "macro.jaffle_shop.bigquery__cents_to_dollars", + "macro_sql": "{% macro bigquery__cents_to_dollars(column_name) %}\n round(cast(({{ column_name }} / 100) as numeric), 2)\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.cents_to_dollars": { + "name": "cents_to_dollars", + "package_name": "jaffle_shop", + "path": "macros/cents_to_dollars.sql", + "original_file_path": "macros/cents_to_dollars.sql", + "unique_id": "macro.jaffle_shop.cents_to_dollars", + "macro_sql": "{% macro cents_to_dollars(column_name) -%}\n {{ return(adapter.dispatch('cents_to_dollars')(column_name)) }}\n{%- endmacro %}", + "depends_on": { + "macros": [ + "macro.jaffle_shop.default__cents_to_dollars" + ] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.default__cents_to_dollars": { + "name": "default__cents_to_dollars", + "package_name": "jaffle_shop", + "path": "macros/cents_to_dollars.sql", + "original_file_path": "macros/cents_to_dollars.sql", + "unique_id": "macro.jaffle_shop.default__cents_to_dollars", + "macro_sql": "{% macro default__cents_to_dollars(column_name) -%}\n ({{ column_name }} / 100)::numeric(16, 2)\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.fabric__cents_to_dollars": { + "name": "fabric__cents_to_dollars", + "package_name": "jaffle_shop", + "path": "macros/cents_to_dollars.sql", + "original_file_path": "macros/cents_to_dollars.sql", + "unique_id": "macro.jaffle_shop.fabric__cents_to_dollars", + "macro_sql": "{% macro fabric__cents_to_dollars(column_name) %}\n cast({{ column_name }} / 100 as numeric(16,2))\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.generate_schema_name": { + "name": "generate_schema_name", + "package_name": "jaffle_shop", + "path": "macros/generate_schema_name.sql", + "original_file_path": "macros/generate_schema_name.sql", + "unique_id": "macro.jaffle_shop.generate_schema_name", + "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) %}\n\n {% set default_schema = target.schema %}\n\n {# seeds go in a global `raw` schema #}\n {% if node.resource_type == 'seed' %}\n {{ custom_schema_name | trim }}\n\n {# non-specified schemas go to the default target schema #}\n {% elif custom_schema_name is none %}\n {{ default_schema }}\n\n\n {# specified custom schema names go to the schema name prepended with the the default schema name in prod (as this is an example project we want the schemas clearly labeled) #}\n {% elif target.name == 'prod' %}\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {# specified custom schemas go to the default target schema for non-prod targets #}\n {% else %}\n {{ default_schema }}\n {% endif %}\n\n{% endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + }, + "macro.jaffle_shop.postgres__cents_to_dollars": { + "name": "postgres__cents_to_dollars", + "package_name": "jaffle_shop", + "path": "macros/cents_to_dollars.sql", + "original_file_path": "macros/cents_to_dollars.sql", + "unique_id": "macro.jaffle_shop.postgres__cents_to_dollars", + "macro_sql": "{% macro postgres__cents_to_dollars(column_name) -%}\n ({{ column_name }}::numeric(16, 2) / 100)\n{%- endmacro %}", + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "config": { + "meta": {}, + "docs": { + "show": true, + "node_color": null + } + }, + "arguments": [], + "resource_type": "macro" + } + }, + "unit_tests": { + "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly": { + "unique_id": "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly", + "database": "jaffle", + "schema": "main", + "name": "test_supply_costs_sum_correctly", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_items", + "test_supply_costs_sum_correctly" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "Test that the counts of drinks and food orders convert to booleans properly.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "test_supply_costs_sum_correctly", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.order_items", + { + "line": 128, + "col": 12, + "index": 3620, + "file": "models/marts/order_items.yml", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "order_items", + "package": "jaffle_shop", + "version": null + } + ], + "sources": [], + "functions": [], + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "enabled": true, + "static_analysis": "strict", + "tags": [] + }, + "model": "order_items", + "given": [ + { + "input": "ref('stg_supplies')", + "rows": [ + { + "product_id": 1, + "supply_cost": 4.5 + }, + { + "product_id": 2, + "supply_cost": 3.5 + }, + { + "product_id": 2, + "supply_cost": 5.0 + } + ], + "format": "dict", + "fixture": null + }, + { + "input": "ref('stg_products')", + "rows": [ + { + "product_id": 1 + }, + { + "product_id": 2 + } + ], + "format": "dict", + "fixture": null + }, + { + "input": "ref('stg_order_items')", + "rows": [ + { + "order_id": 1, + "product_id": 1 + }, + { + "order_id": 2, + "product_id": 2 + }, + { + "order_id": 2, + "product_id": 2 + } + ], + "format": "dict", + "fixture": null + }, + { + "input": "ref('stg_orders')", + "rows": [ + { + "order_id": 1 + }, + { + "order_id": 2 + } + ], + "format": "dict", + "fixture": null + } + ], + "expect": { + "rows": [ + { + "order_id": 1, + "product_id": 1, + "supply_cost": 4.5 + }, + { + "order_id": 2, + "product_id": 2, + "supply_cost": 8.5 + }, + { + "order_id": 2, + "product_id": 2, + "supply_cost": 8.5 + } + ], + "format": "dict", + "fixture": null + }, + "tested_node_unique_id": "model.jaffle_shop.order_items", + "resource_type": "unit_test" + }, + "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly": { + "unique_id": "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly", + "database": "jaffle", + "schema": "main", + "name": "test_order_items_compute_to_bools_correctly", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "orders", + "test_order_items_compute_to_bools_correctly" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Test that the counts of drinks and food orders convert to booleans properly.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "test_order_items_compute_to_bools_correctly", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 136, + "col": 12, + "index": 4239, + "file": "models/marts/orders.yml", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": "jaffle_shop", + "version": null + } + ], + "sources": [], + "functions": [], + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "enabled": true, + "static_analysis": "strict", + "tags": [] + }, + "model": "orders", + "given": [ + { + "input": "ref('order_items')", + "rows": [ + { + "is_drink_item": false, + "is_food_item": true, + "order_id": 1, + "order_item_id": 1 + }, + { + "is_drink_item": true, + "is_food_item": false, + "order_id": 1, + "order_item_id": 2 + }, + { + "is_drink_item": false, + "is_food_item": true, + "order_id": 2, + "order_item_id": 3 + } + ], + "format": "dict", + "fixture": null + }, + { + "input": "ref('stg_orders')", + "rows": [ + { + "order_id": 1 + }, + { + "order_id": 2 + } + ], + "format": "dict", + "fixture": null + } + ], + "expect": { + "rows": [ + { + "count_drink_items": 1, + "count_food_items": 1, + "is_drink_order": true, + "is_food_order": true, + "order_id": 1 + }, + { + "count_drink_items": 0, + "count_food_items": 1, + "is_drink_order": false, + "is_food_order": true, + "order_id": 2 + } + ], + "format": "dict", + "fixture": null + }, + "tested_node_unique_id": "model.jaffle_shop.orders", + "resource_type": "unit_test" + }, + "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date": { + "unique_id": "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date", + "database": "jaffle", + "schema": "main", + "name": "test_does_location_opened_at_trunc_to_date", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "staging", + "stg_locations", + "test_does_location_opened_at_trunc_to_date" + ], + "path": "staging/stg_locations.yml", + "original_file_path": "models/staging/stg_locations.yml", + "description": "Check that opened_at timestamp is properly truncated to a date.", + "tags": [], + "classifiers": [], + "meta": {}, + "alias": "test_does_location_opened_at_trunc_to_date", + "columns": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.stg_locations" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.stg_locations", + { + "line": 14, + "col": 12, + "index": 456, + "file": "models/staging/stg_locations.yml", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "stg_locations", + "package": "jaffle_shop", + "version": null + } + ], + "sources": [], + "functions": [], + "unrendered_config": {}, + "metrics": [], + "checksum": { + "name": "none", + "checksum": "" + }, + "language": "sql", + "contract": { + "alias_types": true, + "enforced": false + }, + "config": { + "enabled": true, + "static_analysis": "strict", + "tags": [] + }, + "model": "stg_locations", + "given": [ + { + "input": "source('ecom', 'raw_stores')", + "rows": [ + { + "id": 1, + "name": "Vice City", + "opened_at": "2016-09-01T00:00:00", + "tax_rate": 0.2 + }, + { + "id": 2, + "name": "San Andreas", + "opened_at": "2079-10-27T23:59:59.9999", + "tax_rate": 0.1 + } + ], + "format": "dict", + "fixture": null + } + ], + "expect": { + "rows": [ + { + "location_id": 1, + "location_name": "Vice City", + "opened_date": "2016-09-01", + "tax_rate": 0.2 + }, + { + "location_id": 2, + "location_name": "San Andreas", + "opened_date": "2079-10-27", + "tax_rate": 0.1 + } + ], + "format": "dict", + "fixture": null + }, + "tested_node_unique_id": "model.jaffle_shop.stg_locations", + "resource_type": "unit_test" + } + }, + "docs": { + "doc.dbt.__overview__": { + "name": "__overview__", + "package_name": "dbt", + "path": "overview.md", + "original_file_path": "docs/overview.md", + "unique_id": "doc.dbt.__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 in 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 models 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 shows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown in 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` button at the top-right of this lineage pane, you'll be able to see all of the models that are used to build, or 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 models 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", + "resource_type": "doc" + } + }, + "semantic_models": { + "semantic_model.jaffle_shop.customers": { + "unique_id": "semantic_model.jaffle_shop.customers", + "name": "customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "customers" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Customer overview data mart, offering key details for each unique customer. One row per customer.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.customers", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "customers", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('customers')", + "node_relation": { + "alias": "customers", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"customers\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": "first_ordered_at" + }, + "entities": [ + { + "name": "customer", + "type": "primary", + "description": "The unique key of the orders mart.", + "label": null, + "role": null, + "expr": "customer_id", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [ + { + "name": "customers", + "agg": "count_distinct", + "description": "Count of unique customers", + "label": "Customers", + "create_metric": true, + "expr": "customer_id", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "first_ordered_at", + "config": null + }, + { + "name": "count_lifetime_orders", + "agg": "sum", + "description": "Total count of orders per customer.", + "label": "Count Lifetime Orders", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "first_ordered_at", + "config": null + }, + { + "name": "lifetime_spend_pretax", + "agg": "sum", + "description": "Customer's lifetime spend before tax", + "label": "LTV Pre-tax", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "first_ordered_at", + "config": null + }, + { + "name": "lifetime_spend", + "agg": "sum", + "description": "Gross customer lifetime spend inclusive of taxes.", + "label": "Lifetime Spend", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "first_ordered_at", + "config": null + } + ], + "dimensions": [ + { + "name": "customer_name", + "type": "categorical", + "description": "Customers' full name.", + "label": null, + "is_partition": false, + "type_params": null, + "expr": "customer_name", + "metadata": null, + "config": null + }, + { + "name": "first_ordered_at", + "type": "time", + "description": "The timestamp when a customer placed their first order.", + "label": null, + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": "first_ordered_at", + "metadata": null, + "config": null + }, + { + "name": "last_ordered_at", + "type": "time", + "description": "The timestamp of a customer's most recent order.", + "label": null, + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": "last_ordered_at", + "metadata": null, + "config": null + }, + { + "name": "customer_type", + "type": "categorical", + "description": "Options are 'new' or 'returning', indicating if a customer has ordered more than once or has only placed their first order to date.", + "label": null, + "is_partition": false, + "type_params": null, + "expr": "customer_type", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + }, + "semantic_model.jaffle_shop.locations": { + "unique_id": "semantic_model.jaffle_shop.locations", + "name": "locations", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "locations" + ], + "path": "marts/locations.yml", + "original_file_path": "models/marts/locations.yml", + "description": "Location dimension table. The grain of the table is one row per location.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.locations" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.locations", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "locations", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('locations')", + "node_relation": { + "alias": "locations", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"locations\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": "opened_date" + }, + "entities": [ + { + "name": "location", + "type": "primary", + "description": "", + "label": null, + "role": null, + "expr": "location_id", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [ + { + "name": "average_tax_rate", + "agg": "average", + "description": "Average tax rate.", + "label": "Average Tax Rate", + "create_metric": true, + "expr": "tax_rate", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "opened_date", + "config": null + } + ], + "dimensions": [ + { + "name": "location_name", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "location_name", + "metadata": null, + "config": null + }, + { + "name": "opened_date", + "type": "time", + "description": null, + "label": null, + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": "opened_date", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + }, + "semantic_model.jaffle_shop.order_items": { + "unique_id": "semantic_model.jaffle_shop.order_items", + "name": "order_items", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_items" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "Items contained in each order. The grain of the table is one row per order item.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.order_items", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "order_items", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('order_items')", + "node_relation": { + "alias": "order_items", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"order_items\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": "ordered_at" + }, + "entities": [ + { + "name": "order_item", + "type": "primary", + "description": "", + "label": null, + "role": null, + "expr": "order_item_id", + "config": { + "meta": {} + }, + "metadata": null + }, + { + "name": "order_id", + "type": "foreign", + "description": "", + "label": null, + "role": null, + "expr": "order_id", + "config": { + "meta": {} + }, + "metadata": null + }, + { + "name": "product", + "type": "foreign", + "description": "", + "label": null, + "role": null, + "expr": "product_id", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [ + { + "name": "revenue", + "agg": "sum", + "description": "The revenue generated for each order item. Revenue is calculated as a sum of revenue associated with each product in an order.", + "label": "Revenue", + "create_metric": true, + "expr": "product_price", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "food_revenue", + "agg": "sum", + "description": "The revenue from food in each order", + "label": "Food Revenue", + "create_metric": true, + "expr": "case when is_food_item then product_price else 0 end", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "drink_revenue", + "agg": "sum", + "description": "The revenue from drinks in each order", + "label": "Drink Revenue", + "create_metric": true, + "expr": "case when is_drink_item then product_price else 0 end", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "median_revenue", + "agg": "median", + "description": "The median revenue generated for each order item. Excludes tax.", + "label": "Median Revenue", + "create_metric": true, + "expr": "product_price", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + } + ], + "dimensions": [ + { + "name": "ordered_at", + "type": "time", + "description": null, + "label": null, + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": "ordered_at", + "metadata": null, + "config": null + }, + { + "name": "is_food_item", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_food_item", + "metadata": null, + "config": null + }, + { + "name": "is_drink_item", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_drink_item", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + }, + "semantic_model.jaffle_shop.orders": { + "unique_id": "semantic_model.jaffle_shop.orders", + "name": "orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Order overview data mart, offering key details for each order inlcluding if it's a customer's first order and a food vs. drink item breakdown. One row per order.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.orders", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "orders", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('orders')", + "node_relation": { + "alias": "orders", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"orders\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": "ordered_at" + }, + "entities": [ + { + "name": "order_id", + "type": "primary", + "description": "The unique key of the orders mart.", + "label": null, + "role": null, + "expr": "order_id", + "config": { + "meta": {} + }, + "metadata": null + }, + { + "name": "customer", + "type": "foreign", + "description": "The foreign key relating to the customer who placed the order.", + "label": null, + "role": null, + "expr": "customer_id", + "config": { + "meta": {} + }, + "metadata": null + }, + { + "name": "location", + "type": "foreign", + "description": "", + "label": null, + "role": null, + "expr": "location_id", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [ + { + "name": "order_total", + "agg": "sum", + "description": "Sum of total order amount. Includes tax + revenue.", + "label": "Order Total", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "orders", + "agg": "sum", + "description": "Count of orders.", + "label": "Orders", + "create_metric": true, + "expr": "1", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "new_customer_orders", + "agg": "sum", + "description": "New customer's first order count", + "label": "New Customers", + "create_metric": true, + "expr": "1", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "large_orders", + "agg": "sum", + "description": "Count of orders with order total over 20.", + "label": "Large Orders", + "create_metric": true, + "expr": "1", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "food_orders", + "agg": "sum", + "description": "Count of orders that contain food order items", + "label": "Food Orders", + "create_metric": true, + "expr": "1", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "drink_orders", + "agg": "sum", + "description": "Count of orders that contain drink order items", + "label": "Drink Orders", + "create_metric": true, + "expr": "1", + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "tax_paid", + "agg": "sum", + "description": "The total tax paid on each order.", + "label": "Tax Paid", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + }, + { + "name": "order_cost", + "agg": "sum", + "description": "The cost for each order item. Cost is calculated as a sum of the supply cost for each order item.", + "label": "Order Cost", + "create_metric": true, + "expr": null, + "agg_params": null, + "non_additive_dimension": null, + "agg_time_dimension": "ordered_at", + "config": null + } + ], + "dimensions": [ + { + "name": "order_total_dim", + "type": "categorical", + "description": "The total amount of the order in USD including tax.", + "label": null, + "is_partition": false, + "type_params": null, + "expr": "order_total", + "metadata": null, + "config": null + }, + { + "name": "ordered_at", + "type": "time", + "description": "The timestamp the order was placed at.", + "label": null, + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": "ordered_at", + "metadata": null, + "config": null + }, + { + "name": "is_food_order", + "type": "categorical", + "description": "A boolean indicating if this order included any food items.", + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_food_order", + "metadata": null, + "config": null + }, + { + "name": "is_drink_order", + "type": "categorical", + "description": "A boolean indicating if this order included any drink items.", + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_drink_order", + "metadata": null, + "config": null + }, + { + "name": "customer_order_number", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "customer_order_number", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + }, + "semantic_model.jaffle_shop.products": { + "unique_id": "semantic_model.jaffle_shop.products", + "name": "products", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "products" + ], + "path": "marts/products.yml", + "original_file_path": "models/marts/products.yml", + "description": "Product dimension table. The grain of the table is one row per product.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.products" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.products", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "products", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('products')", + "node_relation": { + "alias": "products", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"products\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": null + }, + "entities": [ + { + "name": "product", + "type": "primary", + "description": "", + "label": null, + "role": null, + "expr": "product_id", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [], + "dimensions": [ + { + "name": "product_name", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "product_name", + "metadata": null, + "config": null + }, + { + "name": "product_type", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "product_type", + "metadata": null, + "config": null + }, + { + "name": "product_description", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "product_description", + "metadata": null, + "config": null + }, + { + "name": "is_food_item", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_food_item", + "metadata": null, + "config": null + }, + { + "name": "is_drink_item", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_drink_item", + "metadata": null, + "config": null + }, + { + "name": "product_price", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "product_price", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + }, + "semantic_model.jaffle_shop.supplies": { + "unique_id": "semantic_model.jaffle_shop.supplies", + "name": "supplies", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "supplies" + ], + "path": "marts/supplies.yml", + "original_file_path": "models/marts/supplies.yml", + "description": "Supplies dimension table. The grain of the table is one row per supply and product combination.\n", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "model.jaffle_shop.supplies" + ], + "nodes_with_ref_location": [ + [ + "model.jaffle_shop.supplies", + { + "line": 0, + "col": 0, + "index": 0, + "file": "", + "expanded": null + } + ] + ] + }, + "refs": [ + { + "name": "supplies", + "package": null, + "version": null + } + ], + "unrendered_config": { + "enabled": true + }, + "created_at": 1794641970.0, + "model": "ref('supplies')", + "node_relation": { + "alias": "supplies", + "schema_name": "main", + "database": "jaffle", + "relation_name": "\"jaffle\".\"main\".\"supplies\"" + }, + "label": null, + "defaults": { + "agg_time_dimension": null + }, + "entities": [ + { + "name": "supply", + "type": "primary", + "description": "", + "label": null, + "role": null, + "expr": "supply_uuid", + "config": { + "meta": {} + }, + "metadata": null + } + ], + "measures": [], + "dimensions": [ + { + "name": "supply_id", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "supply_id", + "metadata": null, + "config": null + }, + { + "name": "product_id", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "product_id", + "metadata": null, + "config": null + }, + { + "name": "supply_name", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "supply_name", + "metadata": null, + "config": null + }, + { + "name": "supply_cost", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "supply_cost", + "metadata": null, + "config": null + }, + { + "name": "is_perishable_supply", + "type": "categorical", + "description": null, + "label": null, + "is_partition": false, + "type_params": null, + "expr": "is_perishable_supply", + "metadata": null, + "config": null + } + ], + "metadata": null, + "primary_entity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "resource_type": "semantic_model" + } + }, + "saved_queries": { + "saved_query.jaffle_shop.customer_order_metrics": { + "unique_id": "saved_query.jaffle_shop.customer_order_metrics", + "name": "customer_order_metrics", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "customer_order_metrics" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Key customer order metrics grouped by customer.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.count_lifetime_orders", + "metric.jaffle_shop.lifetime_spend_pretax", + "metric.jaffle_shop.average_order_value" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "query_params": { + "metrics": [ + "count_lifetime_orders", + "lifetime_spend_pretax", + "average_order_value" + ], + "group_by": [ + "Entity('customer')" + ], + "where": null, + "order_by": [], + "limit": null + }, + "exports": [ + { + "name": "customer_order_metrics", + "config": { + "export_as": "table", + "schema_name": "public", + "alias": "customer_order_metrics", + "database": "jaffle" + }, + "unrendered_config": { + "export_as": "table" + } + } + ], + "label": "Customer Order Metrics", + "metadata": null, + "group": null, + "config": { + "cache": { + "enabled": false + }, + "enabled": true, + "export_as": null, + "schema": null, + "group": null, + "meta": {}, + "tags": [] + }, + "resource_type": "saved_query" + }, + "saved_query.jaffle_shop.order_metrics": { + "unique_id": "saved_query.jaffle_shop.order_metrics", + "name": "order_metrics", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_metrics" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Key order metrics grouped by day.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.orders", + "metric.jaffle_shop.new_customer_orders", + "metric.jaffle_shop.order_total", + "metric.jaffle_shop.food_orders", + "metric.jaffle_shop.drink_orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "query_params": { + "metrics": [ + "orders", + "new_customer_orders", + "order_total", + "food_orders", + "drink_orders" + ], + "group_by": [ + "TimeDimension('metric_time', 'day')" + ], + "where": null, + "order_by": [], + "limit": null + }, + "exports": [ + { + "name": "order_metrics", + "config": { + "export_as": "table", + "schema_name": "public", + "alias": "order_metrics", + "database": "jaffle" + }, + "unrendered_config": { + "export_as": "table" + } + } + ], + "label": "Order Metrics", + "metadata": null, + "group": null, + "config": { + "cache": { + "enabled": false + }, + "enabled": true, + "export_as": null, + "schema": null, + "group": null, + "meta": {}, + "tags": [] + }, + "resource_type": "saved_query" + }, + "saved_query.jaffle_shop.revenue_metrics": { + "unique_id": "saved_query.jaffle_shop.revenue_metrics", + "name": "revenue_metrics", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "revenue_metrics" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "Key revenue metrics grouped by day.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.revenue", + "metric.jaffle_shop.food_revenue", + "metric.jaffle_shop.drink_revenue" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "query_params": { + "metrics": [ + "revenue", + "food_revenue", + "drink_revenue" + ], + "group_by": [ + "TimeDimension('metric_time', 'day')" + ], + "where": null, + "order_by": [], + "limit": null + }, + "exports": [ + { + "name": "revenue_metrics", + "config": { + "export_as": "table", + "schema_name": "public", + "alias": "revenue_metrics", + "database": "jaffle" + }, + "unrendered_config": { + "export_as": "table" + } + } + ], + "label": "Revenue Metrics", + "metadata": null, + "group": null, + "config": { + "cache": { + "enabled": false + }, + "enabled": true, + "export_as": null, + "schema": null, + "group": null, + "meta": {}, + "tags": [] + }, + "resource_type": "saved_query" + } + }, + "exposures": {}, + "metrics": { + "metric.jaffle_shop.average_order_value": { + "unique_id": "metric.jaffle_shop.average_order_value", + "name": "average_order_value", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "average_order_value" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "LTV pre-tax / number of orders", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.count_lifetime_orders", + "metric.jaffle_shop.lifetime_spend_pretax" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Average Order Value", + "type": "derived", + "type_params": { + "measure": null, + "input_measures": [ + { + "name": "count_lifetime_orders", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + }, + { + "name": "lifetime_spend_pretax", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + } + ], + "numerator": null, + "denominator": null, + "expr": "lifetime_spend_pretax / count_lifetime_orders", + "window": null, + "grain_to_date": null, + "metrics": [ + { + "name": "count_lifetime_orders", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + { + "name": "lifetime_spend_pretax", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + } + ], + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.average_tax_rate": { + "unique_id": "metric.jaffle_shop.average_tax_rate", + "name": "average_tax_rate", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "average_tax_rate" + ], + "path": "marts/locations.yml", + "original_file_path": "models/marts/locations.yml", + "description": "Average tax rate.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.locations" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Average Tax Rate", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "tax_rate", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "locations", + "agg": "average", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "opened_date", + "non_additive_dimension": null, + "expr": "tax_rate" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.count_lifetime_orders": { + "unique_id": "metric.jaffle_shop.count_lifetime_orders", + "name": "count_lifetime_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "count_lifetime_orders" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Total count of orders per customer.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Count Lifetime Orders", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "customers", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "first_ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.cumulative_revenue": { + "unique_id": "metric.jaffle_shop.cumulative_revenue", + "name": "cumulative_revenue", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "cumulative_revenue" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The cumulative revenue for all orders.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.revenue" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Cumulative Revenue (All Time)", + "type": "cumulative", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": { + "window": null, + "grain_to_date": null, + "period_agg": "first", + "metric": { + "name": "revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + } + }, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.customers": { + "unique_id": "metric.jaffle_shop.customers", + "name": "customers", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "customers" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Count of unique customers", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Customers", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "customer_id", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "customers", + "agg": "count_distinct", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "first_ordered_at", + "non_additive_dimension": null, + "expr": "customer_id" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.drink_orders": { + "unique_id": "metric.jaffle_shop.drink_orders", + "name": "drink_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "drink_orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Count of orders that contain drink order items", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Drink Orders", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "1", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "1" + } + }, + "filter": { + "where_filters": [ + { + "where_sql_template": "{{ Dimension('order_id__is_drink_order') }} = true\n" + } + ] + }, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.drink_revenue": { + "unique_id": "metric.jaffle_shop.drink_revenue", + "name": "drink_revenue", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "drink_revenue" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The revenue from drinks in each order", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Drink Revenue", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "case when is_drink_item then product_price else 0 end", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "order_items", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "case when is_drink_item then product_price else 0 end" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.drink_revenue_pct": { + "unique_id": "metric.jaffle_shop.drink_revenue_pct", + "name": "drink_revenue_pct", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "drink_revenue_pct" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The % of order revenue from drinks.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.drink_revenue", + "metric.jaffle_shop.revenue" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Drink Revenue %", + "type": "ratio", + "type_params": { + "measure": null, + "input_measures": [ + { + "name": "drink_revenue", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + }, + { + "name": "revenue", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + } + ], + "numerator": { + "name": "drink_revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "denominator": { + "name": "revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.food_orders": { + "unique_id": "metric.jaffle_shop.food_orders", + "name": "food_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "food_orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Count of orders that contain food order items", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Food Orders", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "1", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "1" + } + }, + "filter": { + "where_filters": [ + { + "where_sql_template": "{{ Dimension('order_id__is_food_order') }} = true\n" + } + ] + }, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.food_revenue": { + "unique_id": "metric.jaffle_shop.food_revenue", + "name": "food_revenue", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "food_revenue" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The revenue from food in each order", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Food Revenue", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "case when is_food_item then product_price else 0 end", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "order_items", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "case when is_food_item then product_price else 0 end" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.food_revenue_pct": { + "unique_id": "metric.jaffle_shop.food_revenue_pct", + "name": "food_revenue_pct", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "food_revenue_pct" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The % of order revenue from food.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.food_revenue", + "metric.jaffle_shop.revenue" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Food Revenue %", + "type": "ratio", + "type_params": { + "measure": null, + "input_measures": [ + { + "name": "food_revenue", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + }, + { + "name": "revenue", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + } + ], + "numerator": { + "name": "food_revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "denominator": { + "name": "revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.large_orders": { + "unique_id": "metric.jaffle_shop.large_orders", + "name": "large_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "large_orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Count of orders with order total over 20.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Large Orders", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "1", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "1" + } + }, + "filter": { + "where_filters": [ + { + "where_sql_template": "{{ Dimension('order_id__order_total_dim') }} >= 20\n" + } + ] + }, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.lifetime_spend": { + "unique_id": "metric.jaffle_shop.lifetime_spend", + "name": "lifetime_spend", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "lifetime_spend" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Gross customer lifetime spend inclusive of taxes.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Lifetime Spend", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "customers", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "first_ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.lifetime_spend_pretax": { + "unique_id": "metric.jaffle_shop.lifetime_spend_pretax", + "name": "lifetime_spend_pretax", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "lifetime_spend_pretax" + ], + "path": "marts/customers.yml", + "original_file_path": "models/marts/customers.yml", + "description": "Customer's lifetime spend before tax", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.customers" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "LTV Pre-tax", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "customers", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "first_ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.median_revenue": { + "unique_id": "metric.jaffle_shop.median_revenue", + "name": "median_revenue", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "median_revenue" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The median revenue generated for each order item. Excludes tax.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Median Revenue", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "product_price", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "order_items", + "agg": "median", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "product_price" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.new_customer_orders": { + "unique_id": "metric.jaffle_shop.new_customer_orders", + "name": "new_customer_orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "new_customer_orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "New customer's first order count", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "New Customers", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "1", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "1" + } + }, + "filter": { + "where_filters": [ + { + "where_sql_template": "{{ Dimension('order_id__customer_order_number') }} = 1\n" + } + ] + }, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.order_cost": { + "unique_id": "metric.jaffle_shop.order_cost", + "name": "order_cost", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_cost" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "The cost for each order item. Cost is calculated as a sum of the supply cost for each order item.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Order Cost", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.order_gross_profit": { + "unique_id": "metric.jaffle_shop.order_gross_profit", + "name": "order_gross_profit", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_gross_profit" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "Gross profit from each order.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.revenue", + "metric.jaffle_shop.order_cost" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Order Gross Profit", + "type": "derived", + "type_params": { + "measure": null, + "input_measures": [ + { + "name": "revenue", + "filter": null, + "alias": null, + "join_to_timespine": false, + "fill_nulls_with": null + }, + { + "name": "order_cost", + "filter": null, + "alias": "cost", + "join_to_timespine": false, + "fill_nulls_with": null + } + ], + "numerator": null, + "denominator": null, + "expr": "revenue - cost", + "window": null, + "grain_to_date": null, + "metrics": [ + { + "name": "revenue", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + { + "name": "order_cost", + "filter": null, + "alias": "cost", + "offset_window": null, + "offset_to_grain": null + } + ], + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.order_total": { + "unique_id": "metric.jaffle_shop.order_total", + "name": "order_total", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "order_total" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Sum of total order amount. Includes tax + revenue.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Order Total", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.orders": { + "unique_id": "metric.jaffle_shop.orders", + "name": "orders", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "orders" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "Count of orders.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Orders", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "1", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "1" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.revenue": { + "unique_id": "metric.jaffle_shop.revenue", + "name": "revenue", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "revenue" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "The revenue generated for each order item. Revenue is calculated as a sum of revenue associated with each product in an order.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.order_items" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Revenue", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": "product_price", + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "order_items", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": "product_price" + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.revenue_growth_mom": { + "unique_id": "metric.jaffle_shop.revenue_growth_mom", + "name": "revenue_growth_mom", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "revenue_growth_mom" + ], + "path": "marts/order_items.yml", + "original_file_path": "models/marts/order_items.yml", + "description": "Percentage growth of revenue compared to 1 month ago. Excludes tax.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "metric.jaffle_shop.revenue" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Revenue Growth % M/M", + "type": "derived", + "type_params": { + "measure": null, + "input_measures": [ + { + "name": "revenue", + "filter": null, + "alias": "current_revenue", + "join_to_timespine": false, + "fill_nulls_with": null + }, + { + "name": "revenue", + "filter": null, + "alias": "revenue_prev_month", + "join_to_timespine": false, + "fill_nulls_with": null + } + ], + "numerator": null, + "denominator": null, + "expr": "(current_revenue - revenue_prev_month)*100/revenue_prev_month", + "window": null, + "grain_to_date": null, + "metrics": [ + { + "name": "revenue", + "filter": null, + "alias": "current_revenue", + "offset_window": null, + "offset_to_grain": null + }, + { + "name": "revenue", + "filter": null, + "alias": "revenue_prev_month", + "offset_window": { + "count": 1, + "granularity": "month" + }, + "offset_to_grain": null + } + ], + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": null + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + }, + "metric.jaffle_shop.tax_paid": { + "unique_id": "metric.jaffle_shop.tax_paid", + "name": "tax_paid", + "package_name": "jaffle_shop", + "fqn": [ + "jaffle_shop", + "marts", + "tax_paid" + ], + "path": "marts/orders.yml", + "original_file_path": "models/marts/orders.yml", + "description": "The total tax paid on each order.", + "tags": [], + "classifiers": [], + "meta": {}, + "depends_on": { + "macros": [], + "nodes": [ + "semantic_model.jaffle_shop.orders" + ], + "nodes_with_ref_location": [] + }, + "refs": [], + "sources": [], + "unrendered_config": {}, + "created_at": 1794641970.0, + "label": "Tax Paid", + "type": "simple", + "type_params": { + "measure": null, + "input_measures": [], + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": null, + "conversion_type_params": null, + "cumulative_type_params": null, + "join_to_timespine": false, + "fill_nulls_with": null, + "is_private": false, + "metric_aggregation_params": { + "semantic_model": "orders", + "agg": "sum", + "agg_params": { + "percentile": null, + "use_discrete_percentile": false, + "use_approximate_percentile": false + }, + "agg_time_dimension": "ordered_at", + "non_additive_dimension": null, + "expr": null + } + }, + "filter": null, + "metadata": null, + "time_granularity": null, + "group": null, + "config": { + "enabled": true, + "meta": {}, + "group": null + }, + "metrics": [], + "resource_type": "metric" + } + }, + "functions": {}, + "child_map": { + "metric.jaffle_shop.average_order_value": [ + "saved_query.jaffle_shop.customer_order_metrics" + ], + "metric.jaffle_shop.average_tax_rate": [], + "metric.jaffle_shop.count_lifetime_orders": [ + "metric.jaffle_shop.average_order_value", + "saved_query.jaffle_shop.customer_order_metrics" + ], + "metric.jaffle_shop.cumulative_revenue": [], + "metric.jaffle_shop.customers": [], + "metric.jaffle_shop.drink_orders": [ + "saved_query.jaffle_shop.order_metrics" + ], + "metric.jaffle_shop.drink_revenue": [ + "metric.jaffle_shop.drink_revenue_pct", + "saved_query.jaffle_shop.revenue_metrics" + ], + "metric.jaffle_shop.drink_revenue_pct": [], + "metric.jaffle_shop.food_orders": [ + "saved_query.jaffle_shop.order_metrics" + ], + "metric.jaffle_shop.food_revenue": [ + "metric.jaffle_shop.food_revenue_pct", + "saved_query.jaffle_shop.revenue_metrics" + ], + "metric.jaffle_shop.food_revenue_pct": [], + "metric.jaffle_shop.large_orders": [], + "metric.jaffle_shop.lifetime_spend": [], + "metric.jaffle_shop.lifetime_spend_pretax": [ + "metric.jaffle_shop.average_order_value", + "saved_query.jaffle_shop.customer_order_metrics" + ], + "metric.jaffle_shop.median_revenue": [], + "metric.jaffle_shop.new_customer_orders": [ + "saved_query.jaffle_shop.order_metrics" + ], + "metric.jaffle_shop.order_cost": [ + "metric.jaffle_shop.order_gross_profit" + ], + "metric.jaffle_shop.order_gross_profit": [], + "metric.jaffle_shop.order_total": [ + "saved_query.jaffle_shop.order_metrics" + ], + "metric.jaffle_shop.orders": [ + "saved_query.jaffle_shop.order_metrics" + ], + "metric.jaffle_shop.revenue": [ + "metric.jaffle_shop.cumulative_revenue", + "metric.jaffle_shop.drink_revenue_pct", + "metric.jaffle_shop.food_revenue_pct", + "metric.jaffle_shop.order_gross_profit", + "metric.jaffle_shop.revenue_growth_mom", + "saved_query.jaffle_shop.revenue_metrics" + ], + "metric.jaffle_shop.revenue_growth_mom": [], + "metric.jaffle_shop.tax_paid": [], + "model.jaffle_shop.customers": [ + "semantic_model.jaffle_shop.customers", + "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8", + "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6", + "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d", + "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1" + ], + "model.jaffle_shop.locations": [ + "semantic_model.jaffle_shop.locations" + ], + "model.jaffle_shop.metricflow_time_spine": [], + "model.jaffle_shop.order_items": [ + "model.jaffle_shop.orders", + "semantic_model.jaffle_shop.order_items", + "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd", + "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8", + "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a", + "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly" + ], + "model.jaffle_shop.orders": [ + "model.jaffle_shop.customers", + "semantic_model.jaffle_shop.orders", + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec", + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92", + "test.jaffle_shop.not_null_orders_order_id.cf6c17daed", + "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8", + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16", + "test.jaffle_shop.unique_orders_order_id.fed79b3a6e", + "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly" + ], + "model.jaffle_shop.products": [ + "semantic_model.jaffle_shop.products" + ], + "model.jaffle_shop.stg_customers": [ + "model.jaffle_shop.customers", + "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa", + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16", + "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada" + ], + "model.jaffle_shop.stg_locations": [ + "model.jaffle_shop.locations", + "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2", + "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc", + "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date" + ], + "model.jaffle_shop.stg_order_items": [ + "model.jaffle_shop.order_items", + "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96", + "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35", + "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54", + "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108" + ], + "model.jaffle_shop.stg_orders": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.orders", + "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc", + "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64", + "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54", + "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a" + ], + "model.jaffle_shop.stg_products": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.products", + "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3", + "test.jaffle_shop.unique_stg_products_product_id.7d950a1467" + ], + "model.jaffle_shop.stg_supplies": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.supplies", + "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d", + "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed" + ], + "model.jaffle_shop.supplies": [ + "semantic_model.jaffle_shop.supplies" + ], + "saved_query.jaffle_shop.customer_order_metrics": [], + "saved_query.jaffle_shop.order_metrics": [], + "saved_query.jaffle_shop.revenue_metrics": [], + "seed.jaffle_shop.raw_customers": [], + "seed.jaffle_shop.raw_items": [], + "seed.jaffle_shop.raw_orders": [], + "seed.jaffle_shop.raw_products": [], + "seed.jaffle_shop.raw_stores": [], + "seed.jaffle_shop.raw_supplies": [], + "semantic_model.jaffle_shop.customers": [ + "metric.jaffle_shop.count_lifetime_orders", + "metric.jaffle_shop.customers", + "metric.jaffle_shop.lifetime_spend", + "metric.jaffle_shop.lifetime_spend_pretax" + ], + "semantic_model.jaffle_shop.locations": [ + "metric.jaffle_shop.average_tax_rate" + ], + "semantic_model.jaffle_shop.order_items": [ + "metric.jaffle_shop.drink_revenue", + "metric.jaffle_shop.food_revenue", + "metric.jaffle_shop.median_revenue", + "metric.jaffle_shop.revenue" + ], + "semantic_model.jaffle_shop.orders": [ + "metric.jaffle_shop.drink_orders", + "metric.jaffle_shop.food_orders", + "metric.jaffle_shop.large_orders", + "metric.jaffle_shop.new_customer_orders", + "metric.jaffle_shop.order_cost", + "metric.jaffle_shop.order_total", + "metric.jaffle_shop.orders", + "metric.jaffle_shop.tax_paid" + ], + "semantic_model.jaffle_shop.products": [], + "semantic_model.jaffle_shop.supplies": [], + "source.jaffle_shop.ecom.raw_customers": [ + "model.jaffle_shop.stg_customers" + ], + "source.jaffle_shop.ecom.raw_items": [ + "model.jaffle_shop.stg_order_items" + ], + "source.jaffle_shop.ecom.raw_orders": [ + "model.jaffle_shop.stg_orders" + ], + "source.jaffle_shop.ecom.raw_products": [ + "model.jaffle_shop.stg_products" + ], + "source.jaffle_shop.ecom.raw_stores": [ + "model.jaffle_shop.stg_locations" + ], + "source.jaffle_shop.ecom.raw_supplies": [ + "model.jaffle_shop.stg_supplies" + ], + "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8": [], + "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6": [], + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec": [], + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92": [], + "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc": [], + "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d": [], + "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd": [], + "test.jaffle_shop.not_null_orders_order_id.cf6c17daed": [], + "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa": [], + "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2": [], + "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96": [], + "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35": [], + "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64": [], + "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3": [], + "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d": [], + "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8": [], + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16": [], + "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54": [], + "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1": [], + "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a": [], + "test.jaffle_shop.unique_orders_order_id.fed79b3a6e": [], + "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada": [], + "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc": [], + "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108": [], + "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a": [], + "test.jaffle_shop.unique_stg_products_product_id.7d950a1467": [], + "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed": [], + "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly": [], + "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly": [], + "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date": [] + }, + "parent_map": { + "metric.jaffle_shop.average_order_value": [ + "metric.jaffle_shop.count_lifetime_orders", + "metric.jaffle_shop.lifetime_spend_pretax" + ], + "metric.jaffle_shop.average_tax_rate": [ + "semantic_model.jaffle_shop.locations" + ], + "metric.jaffle_shop.count_lifetime_orders": [ + "semantic_model.jaffle_shop.customers" + ], + "metric.jaffle_shop.cumulative_revenue": [ + "metric.jaffle_shop.revenue" + ], + "metric.jaffle_shop.customers": [ + "semantic_model.jaffle_shop.customers" + ], + "metric.jaffle_shop.drink_orders": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.drink_revenue": [ + "semantic_model.jaffle_shop.order_items" + ], + "metric.jaffle_shop.drink_revenue_pct": [ + "metric.jaffle_shop.drink_revenue", + "metric.jaffle_shop.revenue" + ], + "metric.jaffle_shop.food_orders": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.food_revenue": [ + "semantic_model.jaffle_shop.order_items" + ], + "metric.jaffle_shop.food_revenue_pct": [ + "metric.jaffle_shop.food_revenue", + "metric.jaffle_shop.revenue" + ], + "metric.jaffle_shop.large_orders": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.lifetime_spend": [ + "semantic_model.jaffle_shop.customers" + ], + "metric.jaffle_shop.lifetime_spend_pretax": [ + "semantic_model.jaffle_shop.customers" + ], + "metric.jaffle_shop.median_revenue": [ + "semantic_model.jaffle_shop.order_items" + ], + "metric.jaffle_shop.new_customer_orders": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.order_cost": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.order_gross_profit": [ + "metric.jaffle_shop.order_cost", + "metric.jaffle_shop.revenue" + ], + "metric.jaffle_shop.order_total": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.orders": [ + "semantic_model.jaffle_shop.orders" + ], + "metric.jaffle_shop.revenue": [ + "semantic_model.jaffle_shop.order_items" + ], + "metric.jaffle_shop.revenue_growth_mom": [ + "metric.jaffle_shop.revenue" + ], + "metric.jaffle_shop.tax_paid": [ + "semantic_model.jaffle_shop.orders" + ], + "model.jaffle_shop.customers": [ + "model.jaffle_shop.orders", + "model.jaffle_shop.stg_customers" + ], + "model.jaffle_shop.locations": [ + "model.jaffle_shop.stg_locations" + ], + "model.jaffle_shop.metricflow_time_spine": [], + "model.jaffle_shop.order_items": [ + "model.jaffle_shop.stg_order_items", + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_products", + "model.jaffle_shop.stg_supplies" + ], + "model.jaffle_shop.orders": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.stg_orders" + ], + "model.jaffle_shop.products": [ + "model.jaffle_shop.stg_products" + ], + "model.jaffle_shop.stg_customers": [ + "source.jaffle_shop.ecom.raw_customers" + ], + "model.jaffle_shop.stg_locations": [ + "source.jaffle_shop.ecom.raw_stores" + ], + "model.jaffle_shop.stg_order_items": [ + "source.jaffle_shop.ecom.raw_items" + ], + "model.jaffle_shop.stg_orders": [ + "source.jaffle_shop.ecom.raw_orders" + ], + "model.jaffle_shop.stg_products": [ + "source.jaffle_shop.ecom.raw_products" + ], + "model.jaffle_shop.stg_supplies": [ + "source.jaffle_shop.ecom.raw_supplies" + ], + "model.jaffle_shop.supplies": [ + "model.jaffle_shop.stg_supplies" + ], + "saved_query.jaffle_shop.customer_order_metrics": [ + "metric.jaffle_shop.average_order_value", + "metric.jaffle_shop.count_lifetime_orders", + "metric.jaffle_shop.lifetime_spend_pretax" + ], + "saved_query.jaffle_shop.order_metrics": [ + "metric.jaffle_shop.drink_orders", + "metric.jaffle_shop.food_orders", + "metric.jaffle_shop.new_customer_orders", + "metric.jaffle_shop.order_total", + "metric.jaffle_shop.orders" + ], + "saved_query.jaffle_shop.revenue_metrics": [ + "metric.jaffle_shop.drink_revenue", + "metric.jaffle_shop.food_revenue", + "metric.jaffle_shop.revenue" + ], + "seed.jaffle_shop.raw_customers": [], + "seed.jaffle_shop.raw_items": [], + "seed.jaffle_shop.raw_orders": [], + "seed.jaffle_shop.raw_products": [], + "seed.jaffle_shop.raw_stores": [], + "seed.jaffle_shop.raw_supplies": [], + "semantic_model.jaffle_shop.customers": [ + "model.jaffle_shop.customers" + ], + "semantic_model.jaffle_shop.locations": [ + "model.jaffle_shop.locations" + ], + "semantic_model.jaffle_shop.order_items": [ + "model.jaffle_shop.order_items" + ], + "semantic_model.jaffle_shop.orders": [ + "model.jaffle_shop.orders" + ], + "semantic_model.jaffle_shop.products": [ + "model.jaffle_shop.products" + ], + "semantic_model.jaffle_shop.supplies": [ + "model.jaffle_shop.supplies" + ], + "source.jaffle_shop.ecom.raw_customers": [], + "source.jaffle_shop.ecom.raw_items": [], + "source.jaffle_shop.ecom.raw_orders": [], + "source.jaffle_shop.ecom.raw_products": [], + "source.jaffle_shop.ecom.raw_stores": [], + "source.jaffle_shop.ecom.raw_supplies": [], + "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd": [ + "model.jaffle_shop.order_items" + ], + "test.jaffle_shop.not_null_orders_order_id.cf6c17daed": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa": [ + "model.jaffle_shop.stg_customers" + ], + "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2": [ + "model.jaffle_shop.stg_locations" + ], + "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96": [ + "model.jaffle_shop.stg_order_items" + ], + "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35": [ + "model.jaffle_shop.stg_order_items" + ], + "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3": [ + "model.jaffle_shop.stg_products" + ], + "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d": [ + "model.jaffle_shop.stg_supplies" + ], + "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8": [ + "model.jaffle_shop.order_items", + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16": [ + "model.jaffle_shop.orders", + "model.jaffle_shop.stg_customers" + ], + "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54": [ + "model.jaffle_shop.stg_order_items", + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a": [ + "model.jaffle_shop.order_items" + ], + "test.jaffle_shop.unique_orders_order_id.fed79b3a6e": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada": [ + "model.jaffle_shop.stg_customers" + ], + "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc": [ + "model.jaffle_shop.stg_locations" + ], + "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108": [ + "model.jaffle_shop.stg_order_items" + ], + "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.unique_stg_products_product_id.7d950a1467": [ + "model.jaffle_shop.stg_products" + ], + "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed": [ + "model.jaffle_shop.stg_supplies" + ], + "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly": [ + "model.jaffle_shop.order_items" + ], + "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly": [ + "model.jaffle_shop.orders" + ], + "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date": [ + "model.jaffle_shop.stg_locations" + ] + }, + "group_map": {}, + "disabled": {}, + "selectors": {}, + "groups": {} +} \ No newline at end of file diff --git a/tests/fixtures/jaffle_shop_v2/run_results.json b/tests/fixtures/jaffle_shop_v2/run_results.json new file mode 100644 index 0000000..0f73581 --- /dev/null +++ b/tests/fixtures/jaffle_shop_v2/run_results.json @@ -0,0 +1,1473 @@ +{ + "metadata": { + "dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v6.json", + "dbt_version": "2.0.11", + "generated_at": "2026-11-14T07:50:19.331200Z", + "invocation_id": "01a1d909-286b-7243-8c09-4b084e073744", + "env": {} + }, + "results": [ + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.948046Z", + "completed_at": "2026-11-14T07:50:18.952358Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.948046Z", + "completed_at": "2026-11-14T07:50:18.952358Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.004312, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_order_items", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_items\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_item_id,\n order_id,\n sku as product_id\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_order_items\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.992819Z", + "completed_at": "2026-11-14T07:50:19.065264Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.992819Z", + "completed_at": "2026-11-14T07:50:19.065264Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.072445, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_orders", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_orders\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as order_id,\n store_id as location_id,\n customer as customer_id,\n\n ---------- numerics\n subtotal as subtotal_cents,\n tax_paid as tax_paid_cents,\n order_total as order_total_cents,\n (subtotal / 100)::numeric(16, 2) as subtotal,\n (tax_paid / 100)::numeric(16, 2) as tax_paid,\n (order_total / 100)::numeric(16, 2) as order_total,\n\n ---------- timestamps\n date_trunc('day', ordered_at) as ordered_at\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_orders\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.892889Z", + "completed_at": "2026-11-14T07:50:18.903784Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.892889Z", + "completed_at": "2026-11-14T07:50:18.903784Z" + } + ], + "thread_id": "Thread-19 (worker)", + "execution_time": 0.010895, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_products", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_products\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n sku as product_id,\n\n ---------- text\n name as product_name,\n type as product_type,\n description as product_description,\n\n\n ---------- numerics\n (price / 100)::numeric(16, 2) as product_price,\n\n ---------- booleans\n coalesce(type = 'jaffle', false) as is_food_item,\n\n coalesce(type = 'beverage', false) as is_drink_item\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_products\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.893220Z", + "completed_at": "2026-11-14T07:50:18.903727Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.893220Z", + "completed_at": "2026-11-14T07:50:18.903727Z" + } + ], + "thread_id": "Thread-11 (worker)", + "execution_time": 0.010507, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_supplies", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_supplies\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n md5(cast(coalesce(cast(id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(sku as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as supply_uuid,\n id as supply_id,\n sku as product_id,\n\n ---------- text\n name as supply_name,\n\n ---------- numerics\n (cost / 100)::numeric(16, 2) as supply_cost,\n\n ---------- booleans\n perishable as is_perishable_supply\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_supplies\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.074151Z", + "completed_at": "2026-11-14T07:50:19.125352Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.074151Z", + "completed_at": "2026-11-14T07:50:19.125352Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.051201, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.order_items", + "compiled": null, + "compiled_code": "with\n\norder_items as (\n\n select * from \"jaffle\".\"main\".\"stg_order_items\"\n\n),\n\n\norders as (\n\n select * from \"jaffle\".\"main\".\"stg_orders\"\n\n),\n\nproducts as (\n\n select * from \"jaffle\".\"main\".\"stg_products\"\n\n),\n\nsupplies as (\n\n select * from \"jaffle\".\"main\".\"stg_supplies\"\n\n),\n\norder_supplies_summary as (\n\n select\n product_id,\n\n sum(supply_cost) as supply_cost\n\n from supplies\n\n group by 1\n\n),\n\njoined as (\n\n select\n order_items.*,\n\n orders.ordered_at,\n\n products.product_name,\n products.product_price,\n products.is_food_item,\n products.is_drink_item,\n\n order_supplies_summary.supply_cost\n\n from order_items\n\n left join orders on order_items.order_id = orders.order_id\n\n left join products on order_items.product_id = products.product_id\n\n left join order_supplies_summary\n on order_items.product_id = order_supplies_summary.product_id\n\n)\n\nselect * from joined", + "relation_name": "\"jaffle\".\"main\".\"order_items\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.131471Z", + "completed_at": "2026-11-14T07:50:19.298688Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.131471Z", + "completed_at": "2026-11-14T07:50:19.298688Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.167217, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.orders", + "compiled": null, + "compiled_code": "with\n\norders as (\n\n select * from \"jaffle\".\"main\".\"stg_orders\"\n\n),\n\norder_items as (\n\n select * from \"jaffle\".\"main\".\"order_items\"\n\n),\n\norder_items_summary as (\n\n select\n order_id,\n\n sum(supply_cost) as order_cost,\n sum(product_price) as order_items_subtotal,\n count(order_item_id) as count_order_items,\n sum(\n case\n when is_food_item then 1\n else 0\n end\n ) as count_food_items,\n sum(\n case\n when is_drink_item then 1\n else 0\n end\n ) as count_drink_items\n\n from order_items\n\n group by 1\n\n),\n\ncompute_booleans as (\n\n select\n orders.*,\n\n order_items_summary.order_cost,\n order_items_summary.order_items_subtotal,\n order_items_summary.count_food_items,\n order_items_summary.count_drink_items,\n order_items_summary.count_order_items,\n order_items_summary.count_food_items > 0 as is_food_order,\n order_items_summary.count_drink_items > 0 as is_drink_order\n\n from orders\n\n left join\n order_items_summary\n on orders.order_id = order_items_summary.order_id\n\n),\n\ncustomer_order_count as (\n\n select\n *,\n\n row_number() over (\n partition by customer_id\n order by ordered_at asc\n ) as customer_order_number\n\n from compute_booleans\n\n)\n\nselect * from customer_order_count", + "relation_name": "\"jaffle\".\"main\".\"orders\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.892606Z", + "completed_at": "2026-11-14T07:50:18.905081Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.892606Z", + "completed_at": "2026-11-14T07:50:18.905081Z" + } + ], + "thread_id": "Thread-9 (worker)", + "execution_time": 0.012475, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_customers", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_customers\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as customer_id,\n\n ---------- text\n name as customer_name\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_customers\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.309687Z", + "completed_at": "2026-11-14T07:50:19.324193Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.309687Z", + "completed_at": "2026-11-14T07:50:19.324193Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.014506, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.customers", + "compiled": null, + "compiled_code": "with\n\ncustomers as (\n\n select * from \"jaffle\".\"main\".\"stg_customers\"\n\n),\n\norders as (\n\n select * from \"jaffle\".\"main\".\"orders\"\n\n),\n\ncustomer_orders_summary as (\n\n select\n orders.customer_id,\n\n count(distinct orders.order_id) as count_lifetime_orders,\n count(distinct orders.order_id) > 1 as is_repeat_buyer,\n min(orders.ordered_at) as first_ordered_at,\n max(orders.ordered_at) as last_ordered_at,\n sum(orders.subtotal) as lifetime_spend_pretax,\n sum(orders.tax_paid) as lifetime_tax_paid,\n sum(orders.order_total) as lifetime_spend\n\n from orders\n\n group by 1\n\n),\n\njoined as (\n\n select\n customers.*,\n\n customer_orders_summary.count_lifetime_orders,\n customer_orders_summary.first_ordered_at,\n customer_orders_summary.last_ordered_at,\n customer_orders_summary.lifetime_spend_pretax,\n customer_orders_summary.lifetime_tax_paid,\n customer_orders_summary.lifetime_spend,\n\n case\n when customer_orders_summary.is_repeat_buyer then 'returning'\n else 'new'\n end as customer_type\n\n from customers\n\n left join customer_orders_summary\n on customers.customer_id = customer_orders_summary.customer_id\n\n)\n\nselect * from joined", + "relation_name": "\"jaffle\".\"main\".\"customers\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.917051Z", + "completed_at": "2026-11-14T07:50:18.947965Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.917051Z", + "completed_at": "2026-11-14T07:50:18.947965Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.030914, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.stg_locations", + "compiled": null, + "compiled_code": "with\n\nsource as (\n\n select * from \"jaffle\".\"raw\".\"raw_stores\"\n\n),\n\nrenamed as (\n\n select\n\n ---------- ids\n id as location_id,\n\n ---------- text\n name as location_name,\n\n ---------- numerics\n tax_rate,\n\n ---------- timestamps\n date_trunc('day', opened_at) as opened_date\n\n from source\n\n)\n\nselect * from renamed", + "relation_name": "\"jaffle\".\"main\".\"stg_locations\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.951043Z", + "completed_at": "2026-11-14T07:50:18.957201Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.951043Z", + "completed_at": "2026-11-14T07:50:18.957201Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.006158, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.locations", + "compiled": null, + "compiled_code": "with\n\nlocations as (\n\n select * from \"jaffle\".\"main\".\"stg_locations\"\n\n)\n\nselect * from locations", + "relation_name": "\"jaffle\".\"main\".\"locations\"", + "batch_results": null + }, + { + "status": "error", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.863003Z", + "completed_at": "2026-11-14T07:50:18.890950Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.863003Z", + "completed_at": "2026-11-14T07:50:18.890950Z" + } + ], + "thread_id": "Thread-8 (worker)", + "execution_time": 0.027947, + "adapter_response": {}, + "message": "Comparison failed: Comparison between timestamp and date with <= operator is not supported", + "failures": null, + "unique_id": "model.jaffle_shop.metricflow_time_spine", + "compiled": null, + "compiled_code": "\n\nwith days as (\n\n \n\n\n \n\n\n with rawdata as (\n\n \n select\n generate_series as generated_number\n from generate_series(1, 10958)\n\n\n ),\n\n all_periods as (\n\n select (\n \n\n (cast('2000-01-01' as date) + cast(row_number() over (order by 1) - 1 as bigint) * interval 1 day)\n ) as date_day\n from rawdata\n\n ),\n\n filtered as (\n\n select *\n from all_periods\n where date_day <= cast('2030-01-01' as date)\n\n )\n\n select * from filtered\n\n\n\n),\n\nfinal as (\n select cast(date_day as date) as date_day\n from days\n)\n\nselect * from final", + "relation_name": "\"jaffle\".\"main\".\"metricflow_time_spine\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.910711Z", + "completed_at": "2026-11-14T07:50:18.946938Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.910711Z", + "completed_at": "2026-11-14T07:50:18.946938Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.036227, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.products", + "compiled": null, + "compiled_code": "with\n\nproducts as (\n\n select * from \"jaffle\".\"main\".\"stg_products\"\n\n)\n\nselect * from products", + "relation_name": "\"jaffle\".\"main\".\"products\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.912088Z", + "completed_at": "2026-11-14T07:50:18.947082Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.912088Z", + "completed_at": "2026-11-14T07:50:18.947082Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.034994, + "adapter_response": { + "_message": "SUCCESS 0", + "code": "SUCCESS", + "message": "SUCCESS 0", + "rows_affected": 0 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "model.jaffle_shop.supplies", + "compiled": null, + "compiled_code": "with\n\nsupplies as (\n\n select * from \"jaffle\".\"main\".\"stg_supplies\"\n\n)\n\nselect * from supplies", + "relation_name": "\"jaffle\".\"main\".\"supplies\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828610Z", + "completed_at": "2026-11-14T07:50:18.884069Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828610Z", + "completed_at": "2026-11-14T07:50:18.884069Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.055459, + "adapter_response": { + "_message": "INSERT 935", + "code": "INSERT", + "message": "INSERT 935", + "rows_affected": 935 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_customers", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_customers\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828590Z", + "completed_at": "2026-11-14T07:50:18.947974Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828590Z", + "completed_at": "2026-11-14T07:50:18.947974Z" + } + ], + "thread_id": "Thread-6 (worker)", + "execution_time": 0.119384, + "adapter_response": { + "_message": "INSERT 90900", + "code": "INSERT", + "message": "INSERT 90900", + "rows_affected": 90900 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_items", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_items\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828594Z", + "completed_at": "2026-11-14T07:50:18.992753Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828594Z", + "completed_at": "2026-11-14T07:50:18.992753Z" + } + ], + "thread_id": "Thread-5 (worker)", + "execution_time": 0.164159, + "adapter_response": { + "_message": "INSERT 61948", + "code": "INSERT", + "message": "INSERT 61948", + "rows_affected": 61948 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_orders", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_orders\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828512Z", + "completed_at": "2026-11-14T07:50:18.884081Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828512Z", + "completed_at": "2026-11-14T07:50:18.884081Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.055569, + "adapter_response": { + "_message": "INSERT 10", + "code": "INSERT", + "message": "INSERT 10", + "rows_affected": 10 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_products", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_products\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828621Z", + "completed_at": "2026-11-14T07:50:18.884075Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828621Z", + "completed_at": "2026-11-14T07:50:18.884075Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.055454, + "adapter_response": { + "_message": "INSERT 6", + "code": "INSERT", + "message": "INSERT 6", + "rows_affected": 6 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_stores", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_stores\"", + "batch_results": null + }, + { + "status": "success", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.828554Z", + "completed_at": "2026-11-14T07:50:18.884375Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.828554Z", + "completed_at": "2026-11-14T07:50:18.884375Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.055821, + "adapter_response": { + "_message": "INSERT 65", + "code": "INSERT", + "message": "INSERT 65", + "rows_affected": 65 + }, + "message": "Succeeded", + "failures": null, + "unique_id": "seed.jaffle_shop.raw_supplies", + "compiled": null, + "compiled_code": null, + "relation_name": "\"jaffle\".\"raw\".\"raw_supplies\"", + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.324331Z", + "completed_at": "2026-11-14T07:50:19.326429Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.324331Z", + "completed_at": "2026-11-14T07:50:19.326429Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.002098, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8", + "compiled": null, + "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n customer_type as value_field,\n count(*) as n_records\n\n from \"jaffle\".\"main\".\"customers\"\n group by customer_type\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'new','returning'\n)\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.324322Z", + "completed_at": "2026-11-14T07:50:19.327055Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.324322Z", + "completed_at": "2026-11-14T07:50:19.327055Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.002733, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_customers_lifetime_spend_pretax_lifetime_tax_paid_lifetime_spend.ad37c989b6", + "compiled": null, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"customers\"\n\nwhere not(lifetime_spend_pretax + lifetime_tax_paid = lifetime_spend)\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298825Z", + "completed_at": "2026-11-14T07:50:19.303103Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298825Z", + "completed_at": "2026-11-14T07:50:19.303103Z" + } + ], + "thread_id": "Thread-5 (worker)", + "execution_time": 0.004278, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_items_subtotal_subtotal.b1416e07ec", + "compiled": null, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"orders\"\n\nwhere not(order_items_subtotal = subtotal)\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298841Z", + "completed_at": "2026-11-14T07:50:19.302147Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298841Z", + "completed_at": "2026-11-14T07:50:19.302147Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.003306, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_orders_order_total_subtotal_tax_paid.2aba85df92", + "compiled": null, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"orders\"\n\nwhere not(order_total = subtotal + tax_paid)\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.065373Z", + "completed_at": "2026-11-14T07:50:19.068960Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.065373Z", + "completed_at": "2026-11-14T07:50:19.068960Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.003587, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.dbt_utils_expression_is_true_stg_orders_order_total_tax_paid_subtotal.bfb885d7fc", + "compiled": null, + "compiled_code": "\n\n\n\nselect\n 1\nfrom \"jaffle\".\"main\".\"stg_orders\"\n\nwhere not(order_total - tax_paid = subtotal)\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.324351Z", + "completed_at": "2026-11-14T07:50:19.326120Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.324351Z", + "completed_at": "2026-11-14T07:50:19.326120Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.001769, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect customer_id\nfrom \"jaffle\".\"main\".\"customers\"\nwhere customer_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.125453Z", + "completed_at": "2026-11-14T07:50:19.127045Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.125453Z", + "completed_at": "2026-11-14T07:50:19.127045Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.001592, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_order_items_order_item_id.c6fda366bd", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect order_item_id\nfrom \"jaffle\".\"main\".\"order_items\"\nwhere order_item_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298840Z", + "completed_at": "2026-11-14T07:50:19.301151Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298840Z", + "completed_at": "2026-11-14T07:50:19.301151Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.002311, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_orders_order_id.cf6c17daed", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"orders\"\nwhere order_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.907110Z", + "completed_at": "2026-11-14T07:50:18.910140Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.907110Z", + "completed_at": "2026-11-14T07:50:18.910140Z" + } + ], + "thread_id": "Thread-8 (worker)", + "execution_time": 0.00303, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect customer_id\nfrom \"jaffle\".\"main\".\"stg_customers\"\nwhere customer_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.948045Z", + "completed_at": "2026-11-14T07:50:18.949739Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.948045Z", + "completed_at": "2026-11-14T07:50:18.949739Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.001694, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect location_id\nfrom \"jaffle\".\"main\".\"stg_locations\"\nwhere location_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.952425Z", + "completed_at": "2026-11-14T07:50:18.956002Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.952425Z", + "completed_at": "2026-11-14T07:50:18.956002Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.003577, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_order_items_order_id.2063801f96", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.952436Z", + "completed_at": "2026-11-14T07:50:18.954892Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.952436Z", + "completed_at": "2026-11-14T07:50:18.954892Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.002456, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect order_item_id\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_item_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.065405Z", + "completed_at": "2026-11-14T07:50:19.067440Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.065405Z", + "completed_at": "2026-11-14T07:50:19.067440Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.002035, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect order_id\nfrom \"jaffle\".\"main\".\"stg_orders\"\nwhere order_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.904553Z", + "completed_at": "2026-11-14T07:50:18.908518Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.904553Z", + "completed_at": "2026-11-14T07:50:18.908518Z" + } + ], + "thread_id": "Thread-7 (worker)", + "execution_time": 0.003965, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect product_id\nfrom \"jaffle\".\"main\".\"stg_products\"\nwhere product_id is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.903893Z", + "completed_at": "2026-11-14T07:50:18.907108Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.903893Z", + "completed_at": "2026-11-14T07:50:18.907108Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.003215, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d", + "compiled": null, + "compiled_code": "\n \n \n\n\n\nselect supply_uuid\nfrom \"jaffle\".\"main\".\"stg_supplies\"\nwhere supply_uuid is null\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298805Z", + "completed_at": "2026-11-14T07:50:19.309605Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298805Z", + "completed_at": "2026-11-14T07:50:19.309605Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.0108, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.relationships_order_items_order_id__order_id__ref_orders_.a799023ee8", + "compiled": null, + "compiled_code": "\n \n \n\nwith child as (\n select order_id as from_field\n from \"jaffle\".\"main\".\"order_items\"\n where order_id is not null\n),\n\nparent as (\n select order_id as to_field\n from \"jaffle\".\"main\".\"orders\"\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\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298829Z", + "completed_at": "2026-11-14T07:50:19.301565Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298829Z", + "completed_at": "2026-11-14T07:50:19.301565Z" + } + ], + "thread_id": "Thread-6 (worker)", + "execution_time": 0.002736, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16", + "compiled": null, + "compiled_code": "\n \n \n\nwith child as (\n select customer_id as from_field\n from \"jaffle\".\"main\".\"orders\"\n where customer_id is not null\n),\n\nparent as (\n select customer_id as to_field\n from \"jaffle\".\"main\".\"stg_customers\"\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\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.065384Z", + "completed_at": "2026-11-14T07:50:19.074086Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.065384Z", + "completed_at": "2026-11-14T07:50:19.074086Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.008702, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.relationships_stg_order_items_order_id__order_id__ref_stg_orders_.dbe9930c54", + "compiled": null, + "compiled_code": "\n \n \n\nwith child as (\n select order_id as from_field\n from \"jaffle\".\"main\".\"stg_order_items\"\n where order_id is not null\n),\n\nparent as (\n select order_id as to_field\n from \"jaffle\".\"main\".\"stg_orders\"\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\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.324321Z", + "completed_at": "2026-11-14T07:50:19.326677Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.324321Z", + "completed_at": "2026-11-14T07:50:19.326677Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.002356, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"customers\"\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.125452Z", + "completed_at": "2026-11-14T07:50:19.131365Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.125452Z", + "completed_at": "2026-11-14T07:50:19.131365Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.005913, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_order_items_order_item_id.7d0a7e900a", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"order_items\"\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.298829Z", + "completed_at": "2026-11-14T07:50:19.305340Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.298829Z", + "completed_at": "2026-11-14T07:50:19.305340Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.006511, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_orders_order_id.fed79b3a6e", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"orders\"\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.907129Z", + "completed_at": "2026-11-14T07:50:18.911196Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.907129Z", + "completed_at": "2026-11-14T07:50:18.911196Z" + } + ], + "thread_id": "Thread-9 (worker)", + "execution_time": 0.004067, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_customers\"\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.948047Z", + "completed_at": "2026-11-14T07:50:18.950987Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.948047Z", + "completed_at": "2026-11-14T07:50:18.950987Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.00294, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_locations\"\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.952444Z", + "completed_at": "2026-11-14T07:50:18.959579Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.952444Z", + "completed_at": "2026-11-14T07:50:18.959579Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.007135, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_order_items\"\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:19.065395Z", + "completed_at": "2026-11-14T07:50:19.071440Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:19.065395Z", + "completed_at": "2026-11-14T07:50:19.071440Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.006045, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_orders\"\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.904257Z", + "completed_at": "2026-11-14T07:50:18.910542Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.904257Z", + "completed_at": "2026-11-14T07:50:18.910542Z" + } + ], + "thread_id": "Thread-4 (worker)", + "execution_time": 0.006285, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_products_product_id.7d950a1467", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n product_id as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_products\"\nwhere product_id is not null\ngroup by product_id\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.903911Z", + "completed_at": "2026-11-14T07:50:18.911901Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.903911Z", + "completed_at": "2026-11-14T07:50:18.911901Z" + } + ], + "thread_id": "Thread-3 (worker)", + "execution_time": 0.00799, + "adapter_response": { + "_message": "SUCCESS 1", + "code": "SUCCESS", + "message": "SUCCESS 1", + "rows_affected": 1 + }, + "message": "Pass", + "failures": 0, + "unique_id": "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed", + "compiled": null, + "compiled_code": "\n \n \n\nselect\n supply_uuid as unique_field,\n count(*) as n_records\n\nfrom \"jaffle\".\"main\".\"stg_supplies\"\nwhere supply_uuid is not null\ngroup by supply_uuid\nhaving count(*) > 1\n\n\n", + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.925037Z", + "completed_at": "2026-11-14T07:50:18.931290Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.925037Z", + "completed_at": "2026-11-14T07:50:18.931290Z" + } + ], + "thread_id": "Thread-2 (worker)", + "execution_time": 0.006253, + "adapter_response": {}, + "message": "Pass", + "failures": null, + "unique_id": "unit_test.jaffle_shop.order_items.test_supply_costs_sum_correctly", + "compiled": null, + "compiled_code": null, + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.932608Z", + "completed_at": "2026-11-14T07:50:18.937827Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.932608Z", + "completed_at": "2026-11-14T07:50:18.937827Z" + } + ], + "thread_id": "Thread-7 (worker)", + "execution_time": 0.005219, + "adapter_response": {}, + "message": "Pass", + "failures": null, + "unique_id": "unit_test.jaffle_shop.orders.test_order_items_compute_to_bools_correctly", + "compiled": null, + "compiled_code": null, + "relation_name": null, + "batch_results": null + }, + { + "status": "pass", + "timing": [ + { + "name": "compile", + "started_at": "2026-11-14T07:50:18.911199Z", + "completed_at": "2026-11-14T07:50:18.916807Z" + }, + { + "name": "execute", + "started_at": "2026-11-14T07:50:18.911199Z", + "completed_at": "2026-11-14T07:50:18.916807Z" + } + ], + "thread_id": "Thread-1 (worker)", + "execution_time": 0.005608, + "adapter_response": {}, + "message": "Pass", + "failures": null, + "unique_id": "unit_test.jaffle_shop.stg_locations.test_does_location_opened_at_trunc_to_date", + "compiled": null, + "compiled_code": null, + "relation_name": null, + "batch_results": null + } + ], + "elapsed_time": 1.1158500000000005, + "args": { + "command": "build", + "which": "build", + "full_refresh": false, + "static_analysis": "Strict", + "warn_error_options": { + "error": [], + "warn": [], + "silence": [] + } + } +} \ No newline at end of file diff --git a/tests/unit/cli/test_cli.py b/tests/unit/cli/test_cli.py index 1fe7c77..3fc5797 100644 --- a/tests/unit/cli/test_cli.py +++ b/tests/unit/cli/test_cli.py @@ -1,3 +1,5 @@ +from functools import partial + from click.testing import CliRunner import dbdocs.cli.main as cli_main @@ -5,6 +7,22 @@ from dbdocs.core.config import DbDocsConfig from dbdocs.core.exceptions import DbDocsConfigError, DeployError, LineageError from dbdocs.main import main +from dbdocs.site.builder import ReportBuilder + + +def _fake_deploy(seen, config, version, alias, push, title, builder): + seen.update(version=version, alias=alias, push=push, title=title, builder=builder) + return "/site/1.2" + + +def _failing_deploy(config, **kwargs): + raise DeployError("push failed") + + +def _fake_builder_for(seen, config): + seen["config"] = config + seen["builder"] = ReportBuilder(config) + return seen["builder"] def test_version_flag_reports_version(): @@ -23,7 +41,7 @@ def test_no_args_shows_help(): def test_generate_builds_site(monkeypatch): seen = {} monkeypatch.setattr( - cli_main.ReportBuilder, + ReportBuilder, "generate", lambda self, output_dir: seen.setdefault("out", output_dir) or "/site", ) @@ -37,7 +55,7 @@ def test_generate_builds_site(monkeypatch): def test_generate_dialect_override(monkeypatch): seen = {} monkeypatch.setattr( - cli_main.ReportBuilder, + ReportBuilder, "generate", lambda self, output_dir: seen.setdefault("dialect", self.config.dialect) or "/site", ) @@ -49,7 +67,7 @@ def test_generate_dialect_override(monkeypatch): def test_generate_run_results_override(monkeypatch): seen = {} monkeypatch.setattr( - cli_main.ReportBuilder, + ReportBuilder, "generate", lambda self, output_dir: seen.setdefault("run_results", self.config.run_results) or "/site", ) @@ -61,7 +79,7 @@ def test_generate_run_results_override(monkeypatch): def test_generate_output_dir_override(monkeypatch): seen = {} monkeypatch.setattr( - cli_main.ReportBuilder, + ReportBuilder, "generate", lambda self, output_dir: seen.setdefault("out", output_dir) or "/x", ) @@ -74,7 +92,7 @@ def test_generate_dbdocs_error_is_clean(monkeypatch): def _boom(self, output_dir): raise LineageError("kaboom") - monkeypatch.setattr(cli_main.ReportBuilder, "generate", _boom) + monkeypatch.setattr(ReportBuilder, "generate", _boom) result = CliRunner().invoke(dbdocs, ["generate"]) assert result.exit_code != 0 assert "kaboom" in result.output @@ -129,23 +147,19 @@ def test_generate_logs_version_banner(monkeypatch): """Build commands keep the version banner (it records the build version).""" msgs = [] monkeypatch.setattr(cli_main.logger, "info", lambda m, *a: msgs.append(m % a)) - monkeypatch.setattr(cli_main.ReportBuilder, "generate", lambda self, output_dir: "/site") + monkeypatch.setattr(ReportBuilder, "generate", lambda self, output_dir: "/site") CliRunner().invoke(dbdocs, ["generate"]) assert any("Run with dbdocs" in m for m in msgs) def test_deploy_command(monkeypatch): seen = {} - - def _deploy(config, version, alias, push, title): - seen.update(version=version, alias=alias, push=push, title=title) - return "/site/1.2" - - monkeypatch.setattr(cli_main.deploy_module, "deploy", _deploy) + monkeypatch.setattr(cli_main.deploy_module, "deploy", partial(_fake_deploy, seen)) result = CliRunner().invoke( dbdocs, ["deploy", "--version", "1.2", "--alias", "latest", "--title", "v1.2", "--push"] ) assert result.exit_code == 0 + assert type(seen.pop("builder")) is ReportBuilder assert seen == {"version": "1.2", "alias": "latest", "push": True, "title": "v1.2"} assert "Deployed version 1.2" in result.output @@ -164,10 +178,7 @@ def _delete(config, version, push): def test_deploy_dbdocs_error_is_clean(monkeypatch): - def _boom(config, version, alias, push, title): - raise DeployError("push failed") - - monkeypatch.setattr(cli_main.deploy_module, "deploy", _boom) + monkeypatch.setattr(cli_main.deploy_module, "deploy", _failing_deploy) result = CliRunner().invoke(dbdocs, ["deploy", "--version", "1.0"]) assert result.exit_code != 0 assert "push failed" in result.output @@ -189,7 +200,7 @@ def test_group_config_option_flows_to_subcommand(monkeypatch, tmp_path): seen = {} monkeypatch.setattr( - cli_main.ReportBuilder, + ReportBuilder, "generate", lambda self, output_dir: seen.setdefault("config", self.config) or "/s", ) @@ -204,3 +215,48 @@ def test_main_entrypoint_invokes_cli(monkeypatch): monkeypatch.setattr("dbdocs.main.cli.dbdocs", lambda: called.append(True)) main() assert called == [True] + + +def _capture_builder(monkeypatch): + seen = {} + monkeypatch.setattr(cli_main, "builder_for", partial(_fake_builder_for, seen)) + monkeypatch.setattr(ReportBuilder, "generate", lambda self, output_dir: "/s") + return seen + + +def test_generate_info_schema_flags_flow_to_config(monkeypatch): + seen = _capture_builder(monkeypatch) + result = CliRunner().invoke( + dbdocs, ["generate", "--info-schema", "--info-schema-dir", "some/dir"] + ) + assert result.exit_code == 0 + assert seen["config"].info_schema is True + assert seen["config"].info_schema_dir == "some/dir" + + +def test_generate_info_schema_defaults_off(monkeypatch): + seen = _capture_builder(monkeypatch) + CliRunner().invoke(dbdocs, ["generate"]) + assert seen["config"].info_schema is False + assert seen["config"].info_schema_dir is None + + +def test_generate_no_info_schema_overrides_config(monkeypatch, tmp_path): + cfg_file = tmp_path / "dbdocs.yml" + cfg_file.write_text("info_schema: true\n", encoding="utf-8") + seen = _capture_builder(monkeypatch) + CliRunner().invoke(dbdocs, ["-c", str(cfg_file), "generate", "--no-info-schema"]) + assert seen["config"].info_schema is False + + +def test_deploy_info_schema_flags_flow_to_config(monkeypatch): + seen = _capture_builder(monkeypatch) + deployed = {} + monkeypatch.setattr(cli_main.deploy_module, "deploy", partial(_fake_deploy, deployed)) + result = CliRunner().invoke( + dbdocs, ["deploy", "--version", "1.0", "--info-schema", "--info-schema-dir", "d"] + ) + assert result.exit_code == 0 + assert seen["config"].info_schema is True + assert seen["config"].info_schema_dir == "d" + assert deployed["builder"] is seen["builder"] diff --git a/tests/unit/core/test_artifacts.py b/tests/unit/core/test_artifacts.py index e8238a7..0ecdd67 100644 --- a/tests/unit/core/test_artifacts.py +++ b/tests/unit/core/test_artifacts.py @@ -1,5 +1,7 @@ from types import SimpleNamespace +import pytest + from dbdocs.core import artifacts @@ -58,17 +60,21 @@ def test_public_constants_exported(): assert artifacts.COLLECTION_ATTRS["metric."] == "metrics" -def test_load_artifacts_uses_dbterd(monkeypatch): - calls = {} +@pytest.fixture +def fake_dbterd(monkeypatch): monkeypatch.setattr(artifacts, "artifact_version", lambda path, artifact: 12) - monkeypatch.setattr( - artifacts.file, - "read_manifest", - lambda path, version: calls.setdefault("m", (path, version)), - ) - monkeypatch.setattr( - artifacts.file, "read_catalog", lambda path, version: calls.setdefault("c", (path, version)) - ) - manifest, catalog = artifacts.load_artifacts("/tmp/target") - assert manifest == ("/tmp/target", 12) - assert catalog == ("/tmp/target", 12) + monkeypatch.setattr(artifacts.file, "read_manifest", lambda path, version: ("m", path, version)) + monkeypatch.setattr(artifacts.file, "read_catalog", lambda path, version: ("c", path, version)) + + +def test_load_artifacts_uses_dbterd(fake_dbterd, tmp_path): + (tmp_path / "catalog.json").write_text("{}", encoding="utf-8") + manifest, catalog = artifacts.load_artifacts(str(tmp_path)) + assert manifest == ("m", str(tmp_path), 12) + assert catalog == ("c", str(tmp_path), 12) + + +def test_load_artifacts_without_catalog_returns_none(fake_dbterd, tmp_path): + manifest, catalog = artifacts.load_artifacts(str(tmp_path)) + assert manifest == ("m", str(tmp_path), 12) + assert catalog is None diff --git a/tests/unit/core/test_config.py b/tests/unit/core/test_config.py index dcc5361..7b68ca3 100644 --- a/tests/unit/core/test_config.py +++ b/tests/unit/core/test_config.py @@ -210,3 +210,19 @@ def test_about_links_flows_into_render_context(): links = [{"label": "Sponsor", "href": "https://example.com"}] context = DbDocsConfig(about_links=links).render_context() assert context["about_links"] == links + + +def test_info_schema_fields_are_build_control(): + context = DbDocsConfig(info_schema=True, info_schema_dir="x").render_context() + assert "info_schema" not in context + assert "info_schema_dir" not in context + + +def test_info_schema_path_defaults_under_target(tmp_path): + config = DbDocsConfig(target_dir=str(tmp_path)) + assert config.info_schema_path == str(tmp_path / "info_schema" / "v1") + + +def test_info_schema_path_honours_override(tmp_path): + config = DbDocsConfig(info_schema_dir=str(tmp_path / "custom")) + assert config.info_schema_path == str(tmp_path / "custom") diff --git a/tests/unit/extract/test_column_lineage.py b/tests/unit/extract/test_column_lineage.py index e0c074e..82c52e6 100644 --- a/tests/unit/extract/test_column_lineage.py +++ b/tests/unit/extract/test_column_lineage.py @@ -165,38 +165,49 @@ def test_schema_from_catalog_skips_catalog_node_without_manifest_entity(fake_man assert "customers" in extractor.schema["db"]["analytics"] -def test_leaf_columns_dedupes_and_skips_unmapped(fake_manifest, fake_catalog): - extractor = ColumnLineageExtractor(fake_manifest, fake_catalog, dialect="snowflake") +_KNOWN_TABLE = exp.Table( + this=exp.to_identifier("raw_customers"), + db=exp.to_identifier("raw"), + catalog=exp.to_identifier("db"), +) + + +def _leaf(name, table): + return SimpleNamespace(name=name, source=table) + + +def _tree(leaves): root = SimpleNamespace(name="root", source=SimpleNamespace()) + root.walk = lambda: iter([root, *leaves]) + return root - def make(name, table): - return SimpleNamespace(name=name, source=table) - known = exp.Table( - this=exp.to_identifier("raw_customers"), - db=exp.to_identifier("raw"), - catalog=exp.to_identifier("db"), - ) +def test_leaf_columns_dedupes_and_skips_unmapped(fake_manifest, fake_catalog): + extractor = ColumnLineageExtractor(fake_manifest, fake_catalog, dialect="snowflake") unknown = exp.Table( this=exp.to_identifier("nope"), db=exp.to_identifier("x"), catalog=exp.to_identifier("y") ) - not_a_table = SimpleNamespace() - leaves = [ - make("t.id", known), - make("t.id", known), - make("u.x", unknown), - make("v.y", not_a_table), - ] - - def walk(): - yield root - yield from leaves - - root.walk = walk + root = _tree( + [ + _leaf("t.id", _KNOWN_TABLE), + _leaf("t.id", _KNOWN_TABLE), + _leaf("u.x", unknown), + _leaf("v.y", SimpleNamespace()), + ] + ) result = column_lineage._leaf_columns(root, extractor._relation_to_node) - # The known table appears once (deduped); unknown + non-table dropped. assert result == [{"node": "source.shop.ecom.raw_customers", "column": "id"}] +def test_leaf_columns_order_is_independent_of_walk_order(fake_manifest, fake_catalog): + extractor = ColumnLineageExtractor(fake_manifest, fake_catalog, dialect="snowflake") + names = ["t.name", "t.id", "t.email"] + forward = _tree([_leaf(n, _KNOWN_TABLE) for n in names]) + backward = _tree([_leaf(n, _KNOWN_TABLE) for n in reversed(names)]) + result = column_lineage._leaf_columns(forward, extractor._relation_to_node) + assert result == column_lineage._leaf_columns(backward, extractor._relation_to_node) + assert [r["column"] for r in result] == ["email", "id", "name"] + + def test_module_logger_is_dbdocs(): assert column_lineage.logger.name == "dbdocs" diff --git a/tests/unit/site/test_builder.py b/tests/unit/site/test_builder.py index 7e991db..4fbdbdc 100644 --- a/tests/unit/site/test_builder.py +++ b/tests/unit/site/test_builder.py @@ -1095,3 +1095,14 @@ def test_generate_sets_versioned_true_when_requested( out = Path(ReportBuilder(config).generate(versioned=True)) data = json.loads((out / "dbdocs-data.json").read_text(encoding="utf-8")) assert data["metadata"]["versioned"] is True + + +def test_default_path_builds_a_catalog_less_dbt2_project(config, v2_target): + config.target_dir = str(v2_target) + data = ReportBuilder(config).build_data() + assert not (v2_target / "catalog.json").exists() + assert "artifact_source" not in data["metadata"] + assert len(data["nodes"]) == 60 + assert len(data["erd"]["nodes"]) == 13 + assert len(data["erd"]["edges"]) == 3 + assert data["health"]["testResults"]["summary"]["pass"] == 30 diff --git a/tests/unit/site/test_deploy.py b/tests/unit/site/test_deploy.py index 68fbe85..d5fa5ab 100644 --- a/tests/unit/site/test_deploy.py +++ b/tests/unit/site/test_deploy.py @@ -8,6 +8,7 @@ from dbdocs.core.config import DbDocsConfig from dbdocs.core.exceptions import DeployError from dbdocs.site import deploy as deploy_mod +from dbdocs.site.builder import ReportBuilder @pytest.fixture @@ -20,7 +21,7 @@ def _fake_generate(self, output_dir=None, versioned=False): (out / "index.html").write_text("", encoding="utf-8") return str(out) - monkeypatch.setattr(deploy_mod.ReportBuilder, "generate", _fake_generate) + monkeypatch.setattr(ReportBuilder, "generate", _fake_generate) def test_deploy_creates_version_dir_and_index(patched_builder, tmp_path): @@ -182,7 +183,7 @@ def _fake_generate(self, output_dir=None, versioned=False): (out / "index.html").write_text("", encoding="utf-8") return str(out) - monkeypatch.setattr(deploy_mod.ReportBuilder, "generate", _fake_generate) + monkeypatch.setattr(ReportBuilder, "generate", _fake_generate) cfg = DbDocsConfig(output_dir=str(tmp_path / "site")) deploy_mod.deploy(cfg, version="1.0") assert calls[0]["versioned"] is True diff --git a/tests/unit/sources/__init__.py b/tests/unit/sources/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/sources/info_schema/__init__.py b/tests/unit/sources/info_schema/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/sources/info_schema/test_builder.py b/tests/unit/sources/info_schema/test_builder.py new file mode 100644 index 0000000..81bf3df --- /dev/null +++ b/tests/unit/sources/info_schema/test_builder.py @@ -0,0 +1,77 @@ +import json + +from dbdocs.site.builder import ReportBuilder +from dbdocs.sources.info_schema.builder import InfoSchemaReportBuilder + + +def _build(config): + return InfoSchemaReportBuilder(config).build_data() + + +def test_build_with_json_enrichment(info_schema_config): + data = _build(info_schema_config) + assert data["metadata"]["artifact_source"] == "info_schema" + assert len(data["nodes"]) == 60 + assert len(data["erd"]["nodes"]) == 13 + assert len(data["erd"]["edges"]) == 3 + assert len(data["lineage"]["edges"]) == 64 + assert sum(len(v) for v in data["columnLineage"].values()) == 87 + assert data["health"]["testResults"]["summary"]["pass"] == 30 + + +def test_build_from_parquet_alone(v2_parquet_only, tmp_path, info_schema_config): + info_schema_config.target_dir = str(v2_parquet_only) + data = _build(info_schema_config) + assert len(data["nodes"]) == 60 + assert len(data["erd"]["edges"]) == 3 + assert data["health"]["testResults"]["summary"]["total"] == 30 + assert data["nodes"]["model.jaffle_shop.orders"]["columns"][0]["type"] + + +def test_empty_column_lineage_keeps_sqlglot(v2_parquet_only, info_schema_config): + (v2_parquet_only / "info_schema" / "v1" / "dbt.column_lineage.parquet").unlink() + info_schema_config.target_dir = str(v2_parquet_only) + data = _build(info_schema_config) + assert data["columnLineage"] + assert data["metadata"]["artifact_source"] == "info_schema" + + +def test_explicit_run_results_path_is_enrichment(info_schema_config, v2_target, tmp_path): + for path in (v2_target / "info_schema" / "v1").glob("dbt_rt.*"): + path.unlink() + info_schema_config.run_results = str(v2_target / "run_results.json") + data = _build(info_schema_config) + assert data["health"]["testResults"]["summary"]["total"] == 30 + + +def test_escaping_run_results_path_falls_back_to_target(info_schema_config, v2_target): + for path in (v2_target / "info_schema" / "v1").glob("dbt_rt.*"): + path.unlink() + info_schema_config.run_results = "../../outside/run_results.json" + data = _build(info_schema_config) + assert data["health"]["testResults"]["summary"]["total"] == 30 + + +def test_unreadable_json_artifacts_are_ignored(info_schema_config, v2_target): + (v2_target / "manifest.json").write_text("{not json", encoding="utf-8") + assert len(_build(info_schema_config)["nodes"]) == 60 + + +def test_generate_writes_site(info_schema_config, tmp_path): + out = InfoSchemaReportBuilder(info_schema_config).generate(output_dir=str(tmp_path / "out")) + payload = json.loads((tmp_path / "out" / "dbdocs-data.json").read_text(encoding="utf-8")) + assert payload["metadata"]["artifact_source"] == "info_schema" + assert out == str(tmp_path / "out") + + +def test_json_path_output_is_unaffected(jaffle_project, config): + config.target_dir = str(jaffle_project / "target") + data = ReportBuilder(config).build_data() + assert "artifact_source" not in data["metadata"] + + +def test_no_run_results_anywhere_leaves_health_empty(v2_parquet_only, info_schema_config): + for path in (v2_parquet_only / "info_schema" / "v1").glob("dbt_rt.*"): + path.unlink() + info_schema_config.target_dir = str(v2_parquet_only) + assert _build(info_schema_config)["health"]["testResults"] is None diff --git a/tests/unit/sources/info_schema/test_reader.py b/tests/unit/sources/info_schema/test_reader.py new file mode 100644 index 0000000..77d2dd7 --- /dev/null +++ b/tests/unit/sources/info_schema/test_reader.py @@ -0,0 +1,53 @@ +import duckdb +import pytest + +from dbdocs.core.exceptions import DbDocsConfigError +from dbdocs.sources.info_schema.reader import InfoSchemaReader + + +def _write_project(directory, schema_version): + directory.mkdir(parents=True, exist_ok=True) + duckdb.connect().execute( + f"COPY (SELECT {schema_version} AS schema_version) " + f"TO '{directory / 'dbt.project.parquet'}' (FORMAT PARQUET)" + ) + + +def test_reads_rows_as_dicts(v2_parquet_only): + reader = InfoSchemaReader(v2_parquet_only / "info_schema" / "v1") + models = reader.table("dbt.models") + assert len(models) == 13 + assert models[0]["unique_id"].startswith("model.") + + +def test_missing_table_reads_empty(v2_parquet_only): + reader = InfoSchemaReader(v2_parquet_only / "info_schema" / "v1") + assert reader.table("dbt.nope") == [] + + +def test_each_table_is_read_once(v2_parquet_only): + reader = InfoSchemaReader(v2_parquet_only / "info_schema" / "v1") + models = reader.table("dbt.models") + (v2_parquet_only / "info_schema" / "v1" / "dbt.models.parquet").unlink() + assert reader.table("dbt.models") is models + + +def test_missing_directory_raises(tmp_path): + with pytest.raises(DbDocsConfigError, match="not found"): + InfoSchemaReader(tmp_path / "absent") + + +def test_unsupported_schema_version_raises(tmp_path): + _write_project(tmp_path, 2) + with pytest.raises(DbDocsConfigError, match="schema_version 2"): + InfoSchemaReader(tmp_path) + + +def test_missing_project_table_raises(tmp_path): + with pytest.raises(DbDocsConfigError, match="schema_version None"): + InfoSchemaReader(tmp_path) + + +def test_supported_schema_version_accepted(tmp_path): + _write_project(tmp_path, 1) + assert InfoSchemaReader(tmp_path).table("dbt.project")[0]["schema_version"] == 1 diff --git a/tests/unit/sources/info_schema/test_synth.py b/tests/unit/sources/info_schema/test_synth.py new file mode 100644 index 0000000..9f20980 --- /dev/null +++ b/tests/unit/sources/info_schema/test_synth.py @@ -0,0 +1,277 @@ +import json +from datetime import datetime, timezone + +from dbdocs.sources.info_schema import synth +from dbdocs.sources.info_schema.reader import InfoSchemaReader + + +def _reader(v2_parquet_only): + return InfoSchemaReader(v2_parquet_only / "info_schema" / "v1") + + +def test_manifest_covers_every_collection(v2_parquet_only): + manifest = synth.build_manifest(_reader(v2_parquet_only)) + assert len(manifest["nodes"]) == 13 + 6 + 27 + assert len(manifest["sources"]) == 6 + assert len(manifest["metrics"]) == 23 + assert manifest["metadata"]["dbt_schema_version"] == synth.MANIFEST_SCHEMA + assert manifest["metadata"]["adapter_type"] == "duckdb" + orders = manifest["nodes"]["model.jaffle_shop.orders"] + assert orders["path"] == "marts/orders.sql" + assert orders["patch_path"] == "jaffle_shop://models/marts/orders.yml" + assert orders["config"]["materialized"] == "table" + assert orders["depends_on"]["nodes"] + assert "version" not in orders + assert orders["columns"]["order_id"]["name"] == "order_id" + assert manifest["parent_map"]["model.jaffle_shop.orders"] == orders["depends_on"]["nodes"] + + +def test_unit_test_checksum_is_a_string(v2_parquet_only): + manifest = synth.build_manifest(_reader(v2_parquet_only)) + assert all(u["checksum"] == "" for u in manifest["unit_tests"].values()) + + +def test_test_node_carries_metadata(v2_parquet_only): + manifest = synth.build_manifest(_reader(v2_parquet_only)) + tests = [n for n in manifest["nodes"].values() if n["resource_type"] == "test"] + relationship = next(t for t in tests if t["test_metadata"]["name"] == "relationships") + assert relationship["test_metadata"]["kwargs"]["to"].startswith("ref(") + assert relationship["attached_node"].startswith("model.") + + +def test_semantic_model_parts_are_nested(v2_parquet_only): + manifest = synth.build_manifest(_reader(v2_parquet_only)) + model = manifest["semantic_models"]["semantic_model.jaffle_shop.orders"] + assert {e["name"] for e in model["entities"]} + assert model["measures"][0]["agg"] + assert any("type_params" in d for d in model["dimensions"]) + assert any("type_params" not in d for d in model["dimensions"]) + + +def test_json_fills_parquet_nulls_and_parquet_wins(fake_reader): + reader = fake_reader( + { + "dbt.models": [ + {"unique_id": "model.p.a", "name": "a", "description": "", "alias": "from_pq"} + ] + } + ) + json_manifest = { + "nodes": { + "model.p.a": { + "description": "from json", + "alias": "from_json", + "depends_on": {"macros": ["macro.p.m"]}, + } + }, + "metadata": {"project_name": "from json"}, + } + node = synth.build_manifest(reader, json_manifest)["nodes"]["model.p.a"] + assert node["description"] == "from json" + assert node["alias"] == "from_pq" + assert node["depends_on"]["macros"] == ["macro.p.m"] + assert node["fqn"] == ["p", "a"] + + +def test_unit_test_checksum_object_from_json_is_flattened(fake_reader): + reader = fake_reader({"dbt.unit_tests": [{"unique_id": "unit_test.p.m.t", "name": "t"}]}) + json_manifest = { + "unit_tests": {"unit_test.p.m.t": {"checksum": {"name": "sha", "checksum": "abc"}}} + } + unit = synth.build_manifest(reader, json_manifest)["unit_tests"]["unit_test.p.m.t"] + assert unit["checksum"] == "abc" + + +def test_remaining_resource_kinds(fake_reader): + reader = fake_reader( + { + "dbt.snapshots": [{"unique_id": "snapshot.p.s", "name": "s", "group": "g"}], + "dbt.exposures": [ + { + "unique_id": "exposure.p.e", + "name": "e", + "exposure_type": "dashboard", + "owner_name": "Ann", + } + ], + "dbt.groups": [{"unique_id": "group.p.g", "name": "g", "owner_email": "a@b.c"}], + "dbt.macros": [ + {"unique_id": "macro.p.m", "name": "m", "arguments": '[{"name": "x"}]'}, + {"unique_id": "macro.p.n", "name": "n", "arguments": "not json"}, + ], + "dbt.docs_blocks": [{"unique_id": "doc.p.d", "name": "d", "content": "hi"}], + "dbt.edges": [ + {"parent_unique_id": "macro.p.m", "child_unique_id": "macro.p.n"}, + {"parent_unique_id": "snapshot.p.s", "child_unique_id": "exposure.p.e"}, + ], + "dbt.project": [{"dbt_version": "2.0.0", "quoting": '{"schema": true}'}], + } + ) + manifest = synth.build_manifest(reader) + assert manifest["exposures"]["exposure.p.e"]["owner"] == {"name": "Ann"} + assert manifest["groups"]["group.p.g"]["owner"] == {"email": "a@b.c"} + assert manifest["group_map"] == {"g": ["snapshot.p.s"]} + assert manifest["macros"]["macro.p.m"]["arguments"] == [{"name": "x"}] + assert "arguments" not in manifest["macros"]["macro.p.n"] + assert manifest["docs"]["doc.p.d"]["block_contents"] == "hi" + assert manifest["child_map"]["snapshot.p.s"] == ["exposure.p.e"] + assert manifest["metadata"]["quoting"] == {"schema": True} + + +def _catalog_rows(): + return { + "dbt.models": [ + {"unique_id": "model.p.a", "name": "a", "schema_name": "s", "materialized": "view"} + ], + "dbt.sources": [{"unique_id": "source.p.src.t", "name": "t", "identifier": "t_id"}], + "dbt.node_columns": [ + { + "node_unique_id": "model.p.a", + "column_name": "Both", + "column_index": 0, + "data_type_actual": "actual", + "data_type_inferred": "inferred", + }, + { + "node_unique_id": "model.p.a", + "column_name": "declared", + "column_index": 1, + "data_type_declared": "decl", + "data_type_inferred": "inferred", + }, + {"node_unique_id": "model.p.a", "column_name": "bare", "column_index": 2}, + {"node_unique_id": "source.p.src.t", "column_name": "c", "data_type_inferred": "Utf8"}, + {"node_unique_id": "model.p.orphan", "column_name": "x"}, + ], + } + + +def test_catalog_type_precedence(fake_reader): + json_catalog = { + "nodes": { + "model.p.a": {"columns": {"BOTH": {"type": "NUMBER"}}, "stats": {"rows": {"value": 1}}}, + "model.p.json_only": {"columns": {}}, + }, + "sources": {"source.p.other": {}}, + } + catalog = synth.build_catalog(fake_reader(_catalog_rows()), json_catalog) + columns = catalog["nodes"]["model.p.a"]["columns"] + assert columns["Both"]["type"] == "NUMBER" + assert columns["declared"]["type"] == "decl" + assert columns["bare"]["type"] == "" + assert catalog["nodes"]["model.p.a"]["stats"] == {"rows": {"value": 1}} + assert catalog["nodes"]["model.p.a"]["metadata"]["type"] == "view" + assert "model.p.json_only" in catalog["nodes"] + assert "source.p.other" in catalog["sources"] + assert catalog["sources"]["source.p.src.t"]["columns"]["c"]["type"] == "Utf8" + assert catalog["sources"]["source.p.src.t"]["metadata"]["name"] == "t_id" + assert "model.p.orphan" not in catalog["nodes"] + + +def test_catalog_prefers_actual_over_inferred(fake_reader): + catalog = synth.build_catalog(fake_reader(_catalog_rows())) + assert catalog["nodes"]["model.p.a"]["columns"]["Both"]["type"] == "actual" + assert catalog["metadata"]["dbt_schema_version"] == synth.CATALOG_SCHEMA + + +def _run_tables(): + return { + "dbt_rt.invocations": [ + { + "invocation_id": "old", + "generated_at": datetime(2020, 1, 1, tzinfo=timezone.utc), + "dbt_version": "2.0.0", + }, + { + "invocation_id": "build", + "generated_at": datetime(2026, 1, 2, tzinfo=timezone.utc), + "elapsed_time": 2.5, + }, + {"invocation_id": "compile", "generated_at": None}, + ], + "dbt_rt.run_results": [ + {"unique_id": "model.p.a", "invocation_id": "build", "status": "success"}, + { + "unique_id": "test.p.t", + "invocation_id": "build", + "status": "pass", + "timing": '[{"name": "execute"}]', + "execution_time": 1.0, + }, + {"unique_id": "model.p.a", "invocation_id": "compile", "status": "success"}, + {"unique_id": "test.p.t", "invocation_id": "old", "status": "fail"}, + ], + } + + +def test_run_results_use_latest_invocation_with_tests(fake_reader): + json_run_results = {"results": [{"unique_id": "test.p.t", "message": "from json"}]} + run_results = synth.build_run_results(fake_reader(_run_tables()), json_run_results) + assert {r["unique_id"] for r in run_results["results"]} == {"model.p.a", "test.p.t"} + test = next(r for r in run_results["results"] if r["unique_id"] == "test.p.t") + assert test["message"] == "from json" + assert test["timing"] == [{"name": "execute"}] + assert run_results["metadata"]["invocation_id"] == "build" + assert run_results["metadata"]["dbt_schema_version"] == synth.RUN_RESULTS_SCHEMA + + +def test_run_results_generated_at_is_isoformat(fake_reader): + run_results = synth.build_run_results(fake_reader(_run_tables())) + assert run_results["metadata"]["invocation_id"] == "build" + assert run_results["metadata"]["generated_at"].startswith("2026-01-02") + assert run_results["elapsed_time"] == 2.5 + + +def test_run_results_fall_back_to_json_without_tests(fake_reader): + fallback = {"results": []} + assert synth.build_run_results(fake_reader({}), fallback) is fallback + assert synth.build_run_results(fake_reader({})) is None + + +def _lineage_row(parent, column, evolution): + return { + "child_node_unique_id": "model.p.b", + "child_column_name": "x", + "parent_node_unique_id": parent, + "parent_column_name": column, + "evolution": evolution, + } + + +def test_column_lineage_keeps_value_sources_sorted_and_unique(fake_reader): + reader = fake_reader( + { + "dbt.column_lineage": [ + _lineage_row("model.p.c", "z", "mod"), + _lineage_row("model.p.a", "y", "copy"), + _lineage_row("model.p.a", "y", "copy"), + _lineage_row("model.p.a", "join_key", "scan"), + _lineage_row("model.p.d", "w", None), + ] + } + ) + assert synth.column_lineage(reader) == { + "model.p.b.x": [ + {"node": "model.p.a", "column": "y"}, + {"node": "model.p.c", "column": "z"}, + {"node": "model.p.d", "column": "w"}, + ] + } + + +def test_column_lineage_of_only_scans_is_empty(fake_reader): + reader = fake_reader({"dbt.column_lineage": [_lineage_row("model.p.a", "k", "scan")]}) + assert synth.column_lineage(reader) == {} + + +def test_staged_artifacts_are_json_serializable(v2_parquet_only): + reader = _reader(v2_parquet_only) + json.dumps(synth.build_manifest(reader), default=str) + + +def test_run_results_without_generated_at_use_now(fake_reader): + tables = { + "dbt_rt.invocations": [{"invocation_id": "i"}], + "dbt_rt.run_results": [{"unique_id": "test.p.t", "invocation_id": "i", "status": "pass"}], + } + assert synth.build_run_results(fake_reader(tables))["metadata"]["generated_at"] diff --git a/tests/unit/sources/test_factory.py b/tests/unit/sources/test_factory.py new file mode 100644 index 0000000..9cd1910 --- /dev/null +++ b/tests/unit/sources/test_factory.py @@ -0,0 +1,43 @@ +import importlib + +import pytest + +from dbdocs.core.config import DbDocsConfig +from dbdocs.core.exceptions import DbDocsConfigError +from dbdocs.site.builder import ReportBuilder +from dbdocs.sources.factory import builder_for +from dbdocs.sources.info_schema.builder import InfoSchemaReportBuilder + + +def test_flag_off_returns_plain_report_builder(): + assert type(builder_for(DbDocsConfig())) is ReportBuilder + + +def test_flag_on_returns_info_schema_builder(info_schema_config): + assert isinstance(builder_for(info_schema_config), InfoSchemaReportBuilder) + + +def _duckdb_missing(name): + raise ModuleNotFoundError("No module named 'duckdb'", name="duckdb") + + +def _other_module_missing(name): + raise ModuleNotFoundError("No module named 'typo'", name="typo") + + +def test_flag_on_without_duckdb_raises(monkeypatch): + monkeypatch.setattr(importlib, "import_module", _duckdb_missing) + with pytest.raises(DbDocsConfigError, match="dbdocs\\[info-schema\\]"): + builder_for(DbDocsConfig(info_schema=True)) + + +def test_other_missing_module_is_not_blamed_on_duckdb(monkeypatch): + monkeypatch.setattr(importlib, "import_module", _other_module_missing) + with pytest.raises(ModuleNotFoundError, match="typo"): + builder_for(DbDocsConfig(info_schema=True)) + + +def test_flag_on_with_missing_dir_raises(tmp_path): + config = DbDocsConfig(target_dir=str(tmp_path), info_schema=True) + with pytest.raises(DbDocsConfigError, match="not found"): + builder_for(config) diff --git a/uv.lock b/uv.lock index d18ed4a..47c276f 100644 --- a/uv.lock +++ b/uv.lock @@ -35,14 +35,14 @@ wheels = [ [[package]] name = "artifact-parser" -version = "1.0.0" +version = "1.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e5/d3/b8523c74bf12393a7e659b855cf3b42bb2b379acd64c9a95e0d2c6d51579/artifact_parser-1.0.0.tar.gz", hash = "sha256:73864c6b2bdcf761adcb4217125bb997d8f1b635f395d080fb4883623e5ac592", size = 201065, upload-time = "2026-06-12T17:05:12.826Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4b/55/9e46041293684c7a07c413574646547d6d6f8d04875a2dbb6ecaabf69dd0/artifact_parser-1.1.0.tar.gz", hash = "sha256:37d7930767295dc7d75261fd00e05ad7719b698ad7405d94dd71a0b87cb902de", size = 212554, upload-time = "2026-11-14T09:07:13.811Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/2a/41/19ecd43052c8185ebdefbf41f5a16fbf94348b7b3a4387d0db2752b7d5c4/artifact_parser-1.0.0-py3-none-any.whl", hash = "sha256:47a827e3dffc087ef04efb1119a7118018a1fb1a6fa508162e07e511518ac1d9", size = 261221, upload-time = "2026-06-12T17:05:11.025Z" }, + { url = "https://files.pythonhosted.org/packages/e1/ef/5d12ca3f9c7844234b2b46671474e216c228ff99baba55909430da255ea8/artifact_parser-1.1.0-py3-none-any.whl", hash = "sha256:4241c424936ba4ad9c91890dc8147b1134f680cf845d56706304302012a50665", size = 276660, upload-time = "2026-11-14T09:07:12.351Z" }, ] [[package]] @@ -356,9 +356,17 @@ dependencies = [ { name = "sqlglot" }, ] +[package.optional-dependencies] +info-schema = [ + { name = "duckdb", version = "1.5.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "duckdb", version = "2.0.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, +] + [package.dev-dependencies] dev = [ { name = "dbt-postgres" }, + { name = "duckdb", version = "1.5.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "duckdb", version = "2.0.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "jsonschema" }, { name = "pdoc" }, { name = "pytest" }, @@ -374,17 +382,20 @@ docs = [ [package.metadata] requires-dist = [ - { name = "artifact-parser", extras = ["dbt"], specifier = ">=1.0.0" }, + { name = "artifact-parser", extras = ["dbt"], specifier = ">=1.1.0" }, { name = "click", specifier = ">=8.1" }, - { name = "dbterd", specifier = ">=1.28" }, + { name = "dbterd", specifier = ">=1.35.1" }, + { name = "duckdb", marker = "extra == 'info-schema'", specifier = ">=1.1" }, { name = "pydantic", specifier = ">=2.13.4" }, { name = "pyyaml", specifier = ">=6.0" }, { name = "sqlglot", specifier = ">=25" }, ] +provides-extras = ["info-schema"] [package.metadata.requires-dev] dev = [ { name = "dbt-postgres", specifier = ">=1.5" }, + { name = "duckdb", specifier = ">=1.1" }, { name = "jsonschema", specifier = ">=4.20" }, { name = "pdoc", specifier = ">=14.4.0" }, { name = "pytest", specifier = ">=8.0" }, @@ -547,7 +558,7 @@ wheels = [ [[package]] name = "dbterd" -version = "1.28.0" +version = "1.35.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "artifact-parser" }, @@ -555,9 +566,9 @@ dependencies = [ { name = "requests" }, { name = "tomli", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/06/09/210b0fd41a1a76ebd37d7f9dab764aee0c9f9e49ada55dd8710d23065b8c/dbterd-1.28.0.tar.gz", hash = "sha256:038b76206ce17d117f9628a12e18ab84d347ba738f9a211a0cef11539ea45967", size = 64499, upload-time = "2026-06-14T14:21:15.976Z" } +sdist = { url = "https://files.pythonhosted.org/packages/5b/f7/7c3fb8003dae42b1c584e473e09993e92954343f62f35259234e1c2ef8a4/dbterd-1.35.1.tar.gz", hash = "sha256:bfe24cadee8c55053e57e95640229e31763c815b2fb41f8ce0c1596322388b1e", size = 72406, upload-time = "2026-11-14T10:06:36.713Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e0/15/0beb8bbb07eac3048ce39a0bd2250ee6948d951d5f718d41bdd0c3fca8b1/dbterd-1.28.0-py3-none-any.whl", hash = "sha256:aa190d8ccf3d2de3107cf41b0c864f57b237bf44e37dcaff185ff1d46229ca18", size = 83797, upload-time = "2026-06-14T14:21:14.54Z" }, + { url = "https://files.pythonhosted.org/packages/d9/5c/376adf9a10793a2ee3e19c7e3e5519d265725cbe332c659d906eced41b9e/dbterd-1.35.1-py3-none-any.whl", hash = "sha256:733799bf369fc954fa792e79af99a13ff66c4dc3faacb20beda81f8e09ad0bcb", size = 91892, upload-time = "2026-11-14T10:06:34.922Z" }, ] [[package]] @@ -572,6 +583,76 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2b/5f/c52bd1255db763d0cdcb7084d2e90c42119cb229302c56bdf1d0aa78abd2/deepdiff-8.6.2-py3-none-any.whl", hash = "sha256:4d22034a866c3928303a9332c279362f714192d9305bac17c498720d095fd1b4", size = 91979, upload-time = "2026-03-18T17:16:32.171Z" }, ] +[[package]] +name = "duckdb" +version = "1.5.6" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] +sdist = { url = "https://files.pythonhosted.org/packages/59/0b/d65ea3be00ea79aa276a8388bec588a9cbf409ce637c6d306e5316210d15/duckdb-1.5.6.tar.gz", hash = "sha256:166a91dbfacfc0c9f08cc76c0243cb6d3d4296bfab5bad72a3cfb63140a5b7c8", size = 18032957, upload-time = "2026-09-28T13:38:37.978Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/e1/5d05ecb59e3fd401414dacc9c969a326fe3a0b1eb07920058b656fe728d6/duckdb-1.5.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:64db8a6700e81fe419fba130d8f1780686ad40fbf2eb69f78d2a1533728a0549", size = 32758341, upload-time = "2026-09-28T13:37:14.588Z" }, + { url = "https://files.pythonhosted.org/packages/0e/d0/a382d9677097a1493049ae38f8219d751db989bfc72bf3a3766dc5af038e/duckdb-1.5.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d6d1eac4de11779bb249b89b0544916ad65751da031df5c5f6d779c85b753109", size = 17372329, upload-time = "2026-09-28T13:37:17.997Z" }, + { url = "https://files.pythonhosted.org/packages/5c/dc/76577ce6520db9e4e8b33f90ec2f503cbf79652a1fd34e391b8043f921f2/duckdb-1.5.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:56355a543a79c7f4d8576d27edcbd9aaed19a562a0901188b021c10f4c818800", size = 15511297, upload-time = "2026-09-28T13:37:20.236Z" }, + { url = "https://files.pythonhosted.org/packages/e0/3e/eeeef69e0c3cf3bb463b544435695647a4802437cfcc2b94035026bf5f84/duckdb-1.5.6-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:95a6b91bb9149950baeb5d02466c006550d0ea98b9d10f15f7d614a8eb32e174", size = 19428638, upload-time = "2026-09-28T13:37:22.436Z" }, + { url = "https://files.pythonhosted.org/packages/58/05/4ed0a651d55c8cbf9f7e826cfa95e67c9955a5db22a0c7c0cc5378f4a90c/duckdb-1.5.6-cp310-cp310-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dbd348e9ebdc8b28f1f9930efb5a74a382063c35d9c43901075566fbae50ab5c", size = 21534632, upload-time = "2026-09-28T13:37:25.139Z" }, + { url = "https://files.pythonhosted.org/packages/33/34/66f49f13f4286871e54b8d5478fb0b10e1f334f6ffe81536213e7fb55f09/duckdb-1.5.6-cp310-cp310-win_amd64.whl", hash = "sha256:f14551eef9180fc72869e2d9a2896410a8826169e22495e98a825abaa0eac1a7", size = 13178288, upload-time = "2026-09-28T13:37:27.578Z" }, + { url = "https://files.pythonhosted.org/packages/36/e5/01e03d30b7ba33a030a4269fdca16ce445ce10f9d29b84a10fdbe0636ad2/duckdb-1.5.6-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c88700d0ee68ad149a0cc624df21b0f21efc136ea2449aaadd7cd0c9a564962a", size = 32757482, upload-time = "2026-09-28T13:37:29.916Z" }, + { url = "https://files.pythonhosted.org/packages/ba/4f/7f7be626a4649a3948ca646c84d6afc1a00121f292f98e6f0d9ed68330df/duckdb-1.5.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:03e4f1b10a8b8ff476eb2b73955590fadbcef978da1167c593114c5edf763960", size = 17372997, upload-time = "2026-09-28T13:37:32.363Z" }, + { url = "https://files.pythonhosted.org/packages/1a/66/9d57573729348d800a0eebdd508f1a833d3714f72e984fef79b47f0e6c45/duckdb-1.5.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:34623eaabd2c66ba5c20f1a39486321c3b7d32e4e0e001ced95f81e3372dd361", size = 15514224, upload-time = "2026-09-28T13:37:34.467Z" }, + { url = "https://files.pythonhosted.org/packages/57/ec/97f595214b3a27b4ca42b8cab6d8121c06f3537dcc4d2da7bca0332de4c5/duckdb-1.5.6-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56c0f71c6bee982e9c30568bb12371bf66b26bf129c75d8d7f60bc69d6590a2c", size = 19428776, upload-time = "2026-09-28T13:37:36.689Z" }, + { url = "https://files.pythonhosted.org/packages/68/4a/ab59f4c1f76fb89e28d23f19b2729538e0723c8d328a07e1b8c37f9ee128/duckdb-1.5.6-cp311-cp311-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:73b108c04c932b36c2fa4e41110cc1c3c8cd510eb49f065f92d050be8e6929fd", size = 21537771, upload-time = "2026-09-28T13:37:39.548Z" }, + { url = "https://files.pythonhosted.org/packages/31/4f/9306c442ecad76f2a4d19f249e7fc8861f139dcf748315102eb69de8ca56/duckdb-1.5.6-cp311-cp311-win_amd64.whl", hash = "sha256:dda311932cf5aae955a53fe28a4fc1700c2ab5fa02dc1f165abdd5ec6c39141e", size = 13179009, upload-time = "2026-09-28T13:37:41.981Z" }, + { url = "https://files.pythonhosted.org/packages/a0/40/8a370e998293d3ebbbac4d926db30bb4ac5f700851a06ac31e7093bee386/duckdb-1.5.6-cp311-cp311-win_arm64.whl", hash = "sha256:df5ae02af278e084f54a9730a9f4f211ed736d0bd8f3bc12af925c2effb5b33d", size = 14046340, upload-time = "2026-09-28T13:37:44.187Z" }, + { url = "https://files.pythonhosted.org/packages/d9/d5/d0ab77a0a1702a43171c93874f44c1f6481e30038bd3987df0d77a16a5c6/duckdb-1.5.6-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:48d07d0651aaeac2c3974afd37599970154b7b79b54c18f27c319c14ccf98d9d", size = 32810486, upload-time = "2026-09-28T13:37:47.254Z" }, + { url = "https://files.pythonhosted.org/packages/9f/cd/b22201de5377faa3be6c38d5f3eaa504cb480392a448bed6a4d2239469b4/duckdb-1.5.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:79de3dfa8705b1ba0d59e7e3252e40ff399e0afd12f485502a6c7bf7c2fd809a", size = 17405278, upload-time = "2026-09-28T13:37:50.135Z" }, + { url = "https://files.pythonhosted.org/packages/9c/6d/f9cfb1493bbdc2f095693a402e42dce1192077f9e11573f00baed6a748de/duckdb-1.5.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:dcccce20965e6986cd083fdf192c461685ad0b93cd1ccd0b2a8207f1185f078b", size = 15532943, upload-time = "2026-09-28T13:37:52.927Z" }, + { url = "https://files.pythonhosted.org/packages/53/04/f65ccfaa5a833f2e570c4a140f03c8f95da416da9fe8ed08401f81f8242a/duckdb-1.5.6-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce89a1025a5317ebe9c520876c48032b5247ac574865486648b1a004f6009875", size = 19454940, upload-time = "2026-09-28T13:37:55.732Z" }, + { url = "https://files.pythonhosted.org/packages/4c/99/be75c788a492f8d77b7a1cdc1b19939ae7be0007f2028691ad371a1a33ee/duckdb-1.5.6-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bc9619ed7d4ffa117b5155d84b44794366bb6635178d78ed5e13a6024845c757", size = 21568087, upload-time = "2026-09-28T13:37:58.191Z" }, + { url = "https://files.pythonhosted.org/packages/b5/95/889f8508960e47c0a7c75cc5bf57cde8512fc24f8db7b3129cca5388da42/duckdb-1.5.6-cp312-cp312-win_amd64.whl", hash = "sha256:09ff51b230219f0d8b47fc8a1e17fb595ba9fab0c3d96a6de4d00b8ff86b3cf1", size = 13190189, upload-time = "2026-09-28T13:38:00.407Z" }, + { url = "https://files.pythonhosted.org/packages/a4/c9/baab503364a68309f8368c88e77f5341e7d94927bdf3e6d703f0e5035f3e/duckdb-1.5.6-cp312-cp312-win_arm64.whl", hash = "sha256:b8d795c8b2d5634b3269f974aa97f1fdf878f62f032317a52252a151b693fb1e", size = 14021977, upload-time = "2026-09-28T13:38:02.682Z" }, + { url = "https://files.pythonhosted.org/packages/b1/5e/a476197fcba557738a588ec844747a19bc0a24b0e6f1809e308f29d68c0e/duckdb-1.5.6-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ae352646374cacf48e9981cf031191c494865192fc436d13667a2531fc5d1da3", size = 32810376, upload-time = "2026-09-28T13:38:05.148Z" }, + { url = "https://files.pythonhosted.org/packages/0c/6d/5466a2b53ddd557644dfa47a763f68748efccdf282e6ae7c4f1bcfb3da69/duckdb-1.5.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a1261e90785e9d29953293e44f60fa073bd1137098924e8de21a037a861b051", size = 17405385, upload-time = "2026-09-28T13:38:07.363Z" }, + { url = "https://files.pythonhosted.org/packages/d4/a0/bf87071170835ee4a34fe764fc11c1c6e7040a0e021b36c1b6f834a4c22f/duckdb-1.5.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:97dd7a555b8f5298b76bc7d48a11cb2c64336e8de9bfde783cffb86ea9f54807", size = 15533132, upload-time = "2026-09-28T13:38:09.681Z" }, + { url = "https://files.pythonhosted.org/packages/31/e0/38095c8e140ecfbe847519ac07bcba94301b8fbb76b2870015e33e07f179/duckdb-1.5.6-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:364992ba1089a2b327391cfcb68fd0bd0ce9090cf293baef861a0ba6847abfee", size = 19454994, upload-time = "2026-09-28T13:38:11.836Z" }, + { url = "https://files.pythonhosted.org/packages/70/21/61dd2876bbaa69cf77d7b5c620e52e8b25faae7096f4d2e4a812b52095d7/duckdb-1.5.6-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:644f54ce99b3b61844bc9a3fe80e0aecb1ea4084b1fffc4396d1569db6111679", size = 21568700, upload-time = "2026-09-28T13:38:14.258Z" }, + { url = "https://files.pythonhosted.org/packages/4a/4a/100730e7785e85268be4d4d5bd62cfc8314e261d2f42efa208243eef35cb/duckdb-1.5.6-cp313-cp313-win_amd64.whl", hash = "sha256:ced693d33ddcee2e5345f077d342c87d2aaa80e41c514e64c9ff2d4e5963c251", size = 13190707, upload-time = "2026-09-28T13:38:16.875Z" }, + { url = "https://files.pythonhosted.org/packages/f3/2e/bc7f44eab4e89ee5c1cb427bb1168ad021d985042e6841ec0694c3d3d501/duckdb-1.5.6-cp313-cp313-win_arm64.whl", hash = "sha256:41ecc75bb9328d72d154a705c1a653d2c5c60f686a5c0c6578aa80020753c884", size = 14020962, upload-time = "2026-09-28T13:38:19.007Z" }, + { url = "https://files.pythonhosted.org/packages/fb/62/a8a30a4c6b94c0861d348ed5633b963f6745a5525527530f02f3c1a7c931/duckdb-1.5.6-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:aa21d2ad803b2524326e8622d7d96b2bb1ff1d5b60368e1978ee805df9c21fb3", size = 32828003, upload-time = "2026-09-28T13:38:21.414Z" }, + { url = "https://files.pythonhosted.org/packages/71/b7/1dcca0005eb8c67adf9fc06bf0cbb1d2bf4ea1974cc89e7a7c2ad66aac28/duckdb-1.5.6-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:8a1b2ad27d414068cbca06c55cfa802eece10f86ea4812ff082f8ab4cb25fc85", size = 17413912, upload-time = "2026-09-28T13:38:23.915Z" }, + { url = "https://files.pythonhosted.org/packages/93/b0/e3ac175443550f3464f2d95731a8b0aae9b4dc3875c3a186c352262b43c2/duckdb-1.5.6-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c79c6d222b1d015cde73b5139087186b00db65357fb4e2c94c2308fbbf465a72", size = 15543122, upload-time = "2026-09-28T13:38:26.317Z" }, + { url = "https://files.pythonhosted.org/packages/9d/08/cc510a7952aba69d5cdca17f3ef61c95713d86143f2ee9aa3e097d38f50b/duckdb-1.5.6-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1052b8050ef5696e2c0d8c836949c72f3dd11f0690466acbea739613e8e2750b", size = 19457946, upload-time = "2026-09-28T13:38:28.877Z" }, + { url = "https://files.pythonhosted.org/packages/ef/a5/6f8099d9a5a02ddff89e5c85875df3465054845b0920fb0703fbdf8dd2ec/duckdb-1.5.6-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:19c5e485e59613b8878d1670bcaa7a010f53c5a4da5ae8e08863e5e529ca6182", size = 21575132, upload-time = "2026-09-28T13:38:31.231Z" }, + { url = "https://files.pythonhosted.org/packages/9f/58/762f7159662d7859e201fa05ca29f306795daeabf84f3e087215a966b001/duckdb-1.5.6-cp314-cp314-win_amd64.whl", hash = "sha256:ebcbd09cd8578ab1093393e9b16289cda0e8f1791ac595bf00eb5bad75c3cf00", size = 13713963, upload-time = "2026-09-28T13:38:33.543Z" }, + { url = "https://files.pythonhosted.org/packages/46/69/64d165db322de13f5c3e75d377b6b9694df1821155ad1fa4b14b04601abc/duckdb-1.5.6-cp314-cp314-win_arm64.whl", hash = "sha256:820a8384faef11cd86068ea48c5da57ce2d8f1c7b3d2bdb9be3398317a7c3728", size = 14514368, upload-time = "2026-09-28T13:38:35.676Z" }, +] + +[[package]] +name = "duckdb" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.11'", +] +sdist = { url = "https://files.pythonhosted.org/packages/c2/7c/dfdf5e9cebefd032f57f09b224993e861ecb55f61e36c709544b04b44f70/duckdb-2.0.0.tar.gz", hash = "sha256:09de511ef0dc76a5213e8d3d87a8b89bb4d3e8a6fe73a9f60dc001269946b44f", size = 16771077, upload-time = "2026-10-21T12:51:13.908Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/73/57/ec7c1a01ab43fc13c55c17cc54a5740886e04ae830aa420ac00614b1420a/duckdb-2.0.0-cp311-cp311-macosx_10_15_universal2.whl", hash = "sha256:a3b38d8cdbef10007c64b65efc4087f799c4dc606785aa5f2a425ed13658ca01", size = 37006608, upload-time = "2026-10-21T12:50:38.611Z" }, + { url = "https://files.pythonhosted.org/packages/84/36/e1ea89acd74917ca654d5adc278765f0116e07540abf4134d5cf9f527363/duckdb-2.0.0-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:9bcc9921be0e1b2404b96a7fb447a8b80fe2f3a919cdc976ca6c39951cc8f2f5", size = 19691094, upload-time = "2026-10-21T12:50:41.839Z" }, + { url = "https://files.pythonhosted.org/packages/4b/81/2895b9ee3858dae7a57f791d7dbd4f116e9fa8fd3c71b9a377dbd4d292a7/duckdb-2.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:61a244faae9fd787e30f4c76888769ec49e79736c434f698e8178a00af8348f0", size = 17603089, upload-time = "2026-10-21T12:50:44.167Z" }, + { url = "https://files.pythonhosted.org/packages/04/95/0c8b5b95ac9e14ee83090a78048fbb23fb9f8abacd63e11a5eee7fcb31e1/duckdb-2.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bcdf10dfbc2c1a6bdc5b2a94bba5b15481e552c5745c2af1994617b0eb6bc750", size = 21637946, upload-time = "2026-10-21T12:50:46.444Z" }, + { url = "https://files.pythonhosted.org/packages/e4/a1/9c3780faada6e6a3edc5f9364cf19810e6e1ea90a7d5fd8fffc48b42c269/duckdb-2.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a3601121c7cc50d0b70412995634682fafcb58a0156d5d663dfd0b3bbe30a33", size = 24351483, upload-time = "2026-10-21T12:50:48.902Z" }, + { url = "https://files.pythonhosted.org/packages/b5/01/0729ac5d9857e5f0bde7262961f80e578a29945a444169886094cc9c69f4/duckdb-2.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:a387d4907b535a4bd82ba8aede6809d0bf023dfbb21362832f3c9848aea7743c", size = 15370691, upload-time = "2026-10-21T12:50:51.59Z" }, + { url = "https://files.pythonhosted.org/packages/09/13/392991ec9dcb22811c7029009184a910bd5cb69fbb7a626f36f151215535/duckdb-2.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:62bea9a1786be98d2906197c67a4089cc8b34d66d19e87e5543d8201e81323ad", size = 15731407, upload-time = "2026-10-21T12:50:53.889Z" }, + { url = "https://files.pythonhosted.org/packages/41/28/1fb52f9ea10205a55a07c32e37cd4fd68fa9d1dc2520a12405ec9bb59cac/duckdb-2.0.0-cp312-abi3-macosx_10_15_universal2.whl", hash = "sha256:cb1cc30318397c3bcffa6b683196293698052588de3c1ba1e144ba0c72560ce9", size = 37003294, upload-time = "2026-10-21T12:50:56.489Z" }, + { url = "https://files.pythonhosted.org/packages/07/5b/fbe92644709fb9162cc51753f92f892b1f333658079d1f11efaed43341d2/duckdb-2.0.0-cp312-abi3-macosx_10_15_x86_64.whl", hash = "sha256:46c7a299ff5f45be9068cfc0ceecb3fd574af9535de8cb6908ae8b52d2846cbd", size = 19689207, upload-time = "2026-10-21T12:50:59.331Z" }, + { url = "https://files.pythonhosted.org/packages/8f/a3/4d23938223626980cdcf18fd6b0dbf040823b5cf15beabbf4ab7ee276631/duckdb-2.0.0-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:b5d758b53751c930e09d371230241005ea5203c8edc65a1e1fafca83fcc906ef", size = 17597612, upload-time = "2026-10-21T12:51:01.818Z" }, + { url = "https://files.pythonhosted.org/packages/92/4a/985fb9d93d7f9f8e82092ddfe05ec8c9a1d0df7bdb0f562a10ced30e3e8f/duckdb-2.0.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e38daf0acbad9de7ce892d402b68409519291ee16af3c2cba85ace3b085c7eaa", size = 21655920, upload-time = "2026-10-21T12:51:04.36Z" }, + { url = "https://files.pythonhosted.org/packages/cc/33/01ad2535ee897db2bad70cbc800655167c53afd0b955eed84f0759c2f417/duckdb-2.0.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ab51ec57d329d6f3df37c0287b55d71c3fc07bb54b61d1afed09104f953b1431", size = 24371005, upload-time = "2026-10-21T12:51:06.86Z" }, + { url = "https://files.pythonhosted.org/packages/09/d3/9e8ca1242b98f04041bef09686ecfe098b41f820aa23240f63f360b64eaf/duckdb-2.0.0-cp312-abi3-win_amd64.whl", hash = "sha256:f61c96547ed432f54dae42a717fd88563eda55cb47549715fac9f61f770c205a", size = 15368860, upload-time = "2026-10-21T12:51:09.395Z" }, + { url = "https://files.pythonhosted.org/packages/37/81/6ea5dc1050f86ec4dd038a2774766b42247ba6104e7785f13a0c600e2b33/duckdb-2.0.0-cp312-abi3-win_arm64.whl", hash = "sha256:c5e6708efaa8647e0914a16f1914354419e529a1925929950e7d610418e45873", size = 15726489, upload-time = "2026-10-21T12:51:11.643Z" }, +] + [[package]] name = "exceptiongroup" version = "1.3.1"